Spaces:
Sleeping
Sleeping
File size: 693 Bytes
0f8617c | 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 | const mongoose = require('mongoose');
const locationSchema = new mongoose.Schema({
name: {
type: String,
required: true
},
description: String,
address: String,
location: {
type: {
type: String,
enum: ['Point'],
default: 'Point'
},
coordinates: {
type: [Number],
required: true
}
},
suggestedBy: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
images: [String]
}, { timestamps: true });
locationSchema.index({ location: '2dsphere' });
const Location = mongoose.model('Location', locationSchema);
module.exports = Location;
|