Skip to content

Instantly share code, notes, and snippets.

@mythicalprogrammer
Created June 12, 2013 19:09
Show Gist options
  • Save mythicalprogrammer/5768191 to your computer and use it in GitHub Desktop.
Save mythicalprogrammer/5768191 to your computer and use it in GitHub Desktop.
Mongoose Connect to DB (named rift) and querying for a user by email.
var mongoose = require('mongoose'),
Admin = require('./models/admin');
var connStr = 'mongodb://localhost:27017/rift';
mongoose.connect(connStr, function(err) {
if (err) throw err;
console.log('Successfully connected to Mongo');
});
Admin.findOne({ email:'[email protected]' },
function(err, admin) {
console.log(admin);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment