1
I own a collection
calling for location
with the following data:
{
_id: ObjectId("5a900f4af1b7fd855010c0cf"),
car_id: ObjectId("5a85c26a35fdcf1098c23480"),
location: {
type:"Point",
coordinates:[-54.585186,-25.447471]
}
}
And I’m trying to make a command aggregate
in the mongoshell
as follows:
db.location.aggregate([{
$geoNear: {
near: { type: "Point", coordinates: [ -73.99279 , 40.719296 ] },
distanceField: "dist.calculated",
includeLocs: "dist.location",
spherical: true,
maxDistance: 10000
}
}])
But I always get this error message:
assert: command failed: {
"ok" : 0,
"errmsg" : "geoNear command failed: { ok: 0.0, errmsg: \"error processing query: ns=taxxer.location limit=100Tree: GEONEAR field=location.location.coordinates maxdist=10000 isNearSphere=1\nSort: {}\nProj: { $...\", code: 2, codeName: \"BadValue\" }",
"code" : 16604,
"codeName" : "Location16604"
} : aggregate failed
I can’t figure out what I’m doing wrong.