Snaplocal / server /src /models /Location.js
Kuruva Laxmi
SnapLocal MVP - Complete platform with 4 MVP features
0f8617c
Raw
History Blame Contribute Delete
693 Bytes
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;