readReference error with node-mongodb-native
var mongodb = require( 'mongodb' ), | |
Server = mongodb.Server, | |
Db = mongodb.Db, | |
MongoModule = {}; | |
MongoModule.setup = function() { | |
// Initialize the db connection | |
var client = new Db( 'tartempion', | |
new Server( | |
'127.0.0.1', | |
27017, | |
{ | |
auto_reconnect: false, | |
poolSize: 4 | |
} | |
) | |
); | |
client.open( function( err, db ) { | |
if ( err ) throw err; | |
MongoModule.db = db; | |
MongoModule.collection( 'pages', function( e, p ) { | |
if ( e ) throw e; | |
console.log( p ); | |
}); | |
console.log( 'Database driver loaded.' ); | |
}); | |
}; | |
MongoModule.collection = function() { | |
this.db.collection.apply( this.db , arguments ); | |
}; | |
MongoModule.setup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment