-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
I get this message every time I try to use find $near - planner returned error: unable to find index for $geoNear query
If the current behavior is a bug, please provide the steps to reproduce.
Example of a document
{ "_id" : ObjectId("5aef5d75d9a9f6943566c201"), "type" : "VULCO", "name" : "Foscar motor", "address" : "Tetuán, Madrid, España", "email" : "foscar@mail.com", "locat" : { "type" : "Point", "coordinates" : [ 40.45883510000001, -3.69782639999994 ] }, "createdAt" : ISODate("2018-05-06T19:54:29.660Z"), "updatedAt" : ISODate("2018-05-06T19:54:29.660Z"), "img" : "https://maps.googleapis.com/maps/api/staticmap?center=40.45883510000001,-3.69782639999994&size=600x300&zoom=15&key=AIzaSyD2Lu_1IfLUoyfzyhUP_HNfGuy9KGQnZoM", "__v" : 0 }
Find function:
Dealer.find({locat: {
$near: {
$geometry:{
type: "Point",
coordinates: coords
},
$maxDistance : 2000
}
}})
What is the expected behavior?
Retrieve near locations from database
Please mention your node.js, mongoose and MongoDB version.
"mongoose": "^5.0.17"
node.js 9.4.9
mongodb 3.4.7