Skip to content

Instantly share code, notes, and snippets.

@kidtronnix
Last active August 29, 2015 14:06
Show Gist options
  • Save kidtronnix/9cf26df20cb58a3f5d02 to your computer and use it in GitHub Desktop.
Save kidtronnix/9cf26df20cb58a3f5d02 to your computer and use it in GitHub Desktop.
MongoDB Connection
// Creates db connection object
var db = new MongoDB(config.db.name, new Server(config.db.host, config.db.port, {auto_reconnect: true}), {w: 1});
db.open(function(e, d) {
if (e) {
console.log(e);
} else{
console.log('connected to database');
}
})
module.exports = db;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment