cuervomonkey
cuervomonkey

Reputation: 96

Mongodb geospatial index error when using $near

I'm receiving an error when attempting to use $near instead of geoNear. The error doesn't give any reason:

{$err: "use geoNear command rather than $near query", "code": 13501}

geoNear works if I use that instead but I'd like to know why $near doesn't...

Upvotes: 0

Views: 579

Answers (1)

cuervomonkey
cuervomonkey

Reputation: 96

Apparently the sharding is the problem:

"$near doesn't work with sharding at the moment. There is an improvement filed to convert it to geoNear on the server."

https://groups.google.com/forum/#!msg/mongodb-user/N8lZHRg1GY4/tXYQWy_s6cQJ

Upvotes: 1

Related Questions