Created
May 31, 2014 18:17
-
-
Save alanhoff/bd15d854040c77eef74e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongodb = require('mongodb'); | |
var config = require(__dirname + '/../config/general.json'); | |
var db = null; | |
mongodb.MongoClient.connect(config.mongodb, function(err, database) { | |
if(err) | |
throw err; | |
db = database; | |
process.emit('dbready'); | |
}); | |
function Functional(){ | |
this.__defineGetter__('collection', function(){ | |
return db.collection.bind(db); | |
}); | |
} | |
module.exports = new Functional(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment