f950dea27fce3ec6a78766cb8eb244f5db35f2a8
[aai/esr-gui.git] /
1
2 // import the necessary modules
3 var mongoose = require('../../lib');
4 var Schema = mongoose.Schema;
5
6 // create an export function to encapsulate the model creation
7 module.exports = function() {
8   // define schema
9   // NOTE : This object must conform *precisely* to the geoJSON specification
10   // you cannot embed a geoJSON doc inside a model or anything like that- IT
11   // MUST BE VANILLA
12   var LocationObject = new Schema({
13     loc: {
14       type: {type: String},
15       coordinates: []
16     }
17   });
18   // define the index
19   LocationObject.index({loc: '2dsphere'});
20
21   mongoose.model('Location', LocationObject);
22 };