Created
June 12, 2013 19:05
-
-
Save mythicalprogrammer/5768159 to your computer and use it in GitHub Desktop.
Mongoose's Model
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
var mongoose = require('mongoose'), | |
Schema = mongoose.Schema; | |
var AdminSchema = new Schema({ | |
name: { type: String, required: true}, | |
email: { type: String, required: true, index: { unique: true } }, | |
password: { type: String, required: true } | |
}); | |
// CRUD operations might be built in not sure... do research! | |
AdminSchema.methods.comparePassword = function(candidatePassword, callback) { | |
//compare code here | |
}; | |
module.exports = mongoose.model('Admin', AdminSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment