Skip to content

Instantly share code, notes, and snippets.

@jonatasnona
Created February 14, 2014 14:34
Show Gist options
  • Save jonatasnona/9001975 to your computer and use it in GitHub Desktop.
Save jonatasnona/9001975 to your computer and use it in GitHub Desktop.
// database.js file
var client = require("mongodb").MongoClient;
client.connect('mongodb://127.0.0.1:27017/foodb', function (err, db) {
if (err) {
throw err;
}
exports.users = db.collection("users");
exports.sessions = db.collection("sessions");
exports.destroy = db.close;
});
// user.js file (loading collection)
var users = require("database").users;
// session.js file (loading collection)
var sessions = require("database").sessions;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment