Skip to content

Instantly share code, notes, and snippets.

@jmoyers
Created May 7, 2011 17:49
Show Gist options
  • Save jmoyers/960683 to your computer and use it in GitHub Desktop.
Save jmoyers/960683 to your computer and use it in GitHub Desktop.
// Assume we're in ~/project/models/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
var User = new Schema({
email : String
, password : String
, name : String
});
mongoose.model('User', User);
module.exports = mongoose.model('User');
// Assume we're in ~/project/
var User = require('./models/user.js');
var u = new User(/** some properties and whatnot **/);
u.save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment