/node_modules/mongoose/examples/querybuilder/person.js

https://bitbucket.org/coleman333/smartsite · JavaScript · 15 lines · 10 code · 2 blank · 3 comment · 0 complexity · 320486e117b23f2c7bf85649e74af7b2 MD5 · raw file

  1. // import the necessary modules
  2. var mongoose = require('../../lib');
  3. var Schema = mongoose.Schema;
  4. // create an export function to encapsulate the model creation
  5. module.exports = function() {
  6. // define schema
  7. var PersonSchema = new Schema({
  8. name: String,
  9. age: Number,
  10. birthday: Date
  11. });
  12. mongoose.model('Person', PersonSchema);
  13. };