Last active
December 10, 2015 08:38
-
-
Save warseph/4409089 to your computer and use it in GitHub Desktop.
Mongoose example
This file contains hidden or 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
| // models.js | |
| var mongoose = require('mongoose'), | |
| Schema = mongoose.Schema, | |
| ObjectId = Schema.ObjectId, | |
| model = mongoose.model; | |
| var userSchema = new Schema({ | |
| name: String, | |
| email: ObjectId, | |
| password: String | |
| }); | |
| exports.User = mongoose.model('User', userSchema); | |
| // test.js | |
| var models = require('./models'); | |
| var user = new models.User({name: 'Test User', email: 'test@test.test', pass: 'pass'}); |
Mephasto
commented
Dec 29, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment