I have looked this up for a while now and I am stuck . I also referred this question and this question and tried it out but I havent been able to get it running.
This is a brief overview of my project: I have a python script that parses data from some logs on a server everyday. each log is a python object which is stored in a collection with the corresponding date in db 'stabilitylogs' in mongoDB.
I have now installed node and mongoose and I am trying to pull out this data from a particular collection named - 130702. I am getting the following error:
C:\node_app\node_modules\mongodb\lib\mongodb\connection\server.js:570
throw err; ^ ReferenceError: Schema is not defined
My stabilitylog.js looks like this:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/stabilitylogs');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function callback () {
var rackSchema=new Schema({
_id: {type: String },
Headend:{
Name: String,
Rack: {
TestInfo:{
ScriptStart: String,
TotalReboots: String,
ScriptLoopCount: String,
ScriptName: String,
ScriptStop: String,
SystemName: String,
TotalSTBs: String,
PerReboots: String,
RunTime: String,
BuildVer: String
},
StbData: [{
Status: String,
UpTime: String,
DBType: String,
IP: String,
DBVersion: String,
RebootData: String,
MAC: String,
MWApp: String,
OS: String
},],
Number: String
}
}
},
{collection: '130702'});
var doc = mongoose.model(rackschema, '130702');
doc.find();
});
I am really new to this and sure that I have many errors in my code but I really need some help here. I am running my entire app on windows 7- installed mongodb ver2.2.4 with the MSI installer and nodeJS - v0.10.12. I installed mongodb and mongoose modules with npm install by writing a package.json file.
Any help is highly appreciated. Also, please let me know if more information is required.