person.js 393 B

1234567891011121314151617
  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. gender: String,
  12. likes: [String]
  13. });
  14. mongoose.model('Person', PersonSchema);
  15. };