Skip to content

Instantly share code, notes, and snippets.

@mythicalprogrammer
Created June 12, 2013 19:05
Show Gist options
  • Save mythicalprogrammer/5768159 to your computer and use it in GitHub Desktop.
Save mythicalprogrammer/5768159 to your computer and use it in GitHub Desktop.
Mongoose's Model
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