arnaucube
arnaucube/thoughtsPublic Self-hosted repository
thoughts/node_modules/mongoose/examples/globalschemas/person.js
node_modules/mongoose/examples/globalschemas/person.jsRaw
 1// import the necessary modules
 2var mongoose = require('../../lib');
 3var Schema = mongoose.Schema;
 4
 5// create an export function to encapsulate the model creation
 6module.exports = function() {
 7  // define schema
 8  var PersonSchema = new Schema({
 9    name: String,
10    age: Number,
11    birthday: Date
12  });
13  mongoose.model('Person', PersonSchema);
14};