0
I have a collection with the following documents.
{
"_id" : ObjectId("5c6bb6b492647b15f80038a1"),
"loc" : {
"type" : "Point",
"coordenadas" : [
-41.104658,
-20.963387
]
}
}
I’m running the find:
db.tblfrota.find(
{ loc : {
$near : {
$geometry : {
type : "Point" ,
coordenadas : [ parseFloat(-41.81064615) , parseFloat(-22.39813884) ]
},
$maxDistance : 5000
}
}
}
)
I have the indexes:
[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_"
},
{
"v" : 2,
"key" : {
"loc.coordenadas" : "2dsphere"
},
"name" : "coord_3d",
"2dsphereIndexVersion" : 3
},
{
"v" : 2,
"key" : {
"coordenadas" : "2d"
},
"name" : "coordenadas_2d"
}
]
Is returning the error :
Error: error: ? "ok" : 0, "errmsg" : "invalid point in geo near query $Geometry argument: { type: "Point", coordinates: [ -41.81064615, -22.39813884 ] } Point must be an array or Object", "code" : 2, "Codename" : "Badvalue" }