19 lines
427 B
JavaScript
19 lines
427 B
JavaScript
|
|
module.exports = function (mongoose) {
|
|
Schema = mongoose.Schema;
|
|
|
|
var schema = new Schema({
|
|
user: { type: Schema.Types.ObjectId, ref: 'User' },
|
|
geometry: {
|
|
type: {
|
|
type: String,
|
|
required: true,
|
|
enum: ['Point'],
|
|
default: 'Point'
|
|
},
|
|
coordinates: { type: [Number], index: '2dsphere' }
|
|
},
|
|
}, { timestamps: true });
|
|
|
|
return mongoose.model('Location', schema);
|
|
} |