forked from jedwood/mongoose-api-query
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel.js
39 lines (35 loc) · 803 Bytes
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var mongoose = require('mongoose');
var mongooseApiQuery = require('./lib/mongoose-api-query');
mongoose.set('debug', true);
var monsterSchema = new mongoose.Schema({
name: String,
title: {
type: String,
required: false
},
tax_identification_no: {
type: Number,
required: false
},
monster_identification_no: Number,
monster_object_id: mongoose.Schema.ObjectId,
eats_humans: Boolean,
foods: [ new mongoose.Schema({
name: String,
vegetarian: Boolean,
calories: Number
})],
vegetarian: {
type: Boolean,
required: false
},
vegan_since: {
type: Date,
required: false
},
loc: Array,
data: {}
});
monsterSchema.index({'loc':'2d'});
monsterSchema.plugin(mongooseApiQuery);
module.exports = mongoose.model('Monster', monsterSchema);