I would need to have something like this
{
event : "something",
location : [
{
long:25, lat:34
}.
}
long:25, lat:35
}.
.
.
.
]
}
Is this possible? And is it possible to have a geospatial index for the location field? I would have queries with $nearSphere.
Thanks
EDIT: mongoose schema question
having the schema entry be something like location : [{ lon : Number, lat: Number}] gets me to end up with an aditional _id for each object in the location array. Is that 1. a problem? 2. a nuissance? 3. something that i can fix?
ex :
{
“lon”:1,
“lat”:2,
“_id”:”50bfeea2a3092d1d67000007″
},
If you don’t want each of the
locationelements to have an_idfield, you can disable that by explicitly defining a schema for the elements with the_idoption set tofalse.Like this: