In the below link, I found that $near 2d legacy use radians as distance measure.
{ $near: [ , ], $maxDistance: }
However, when I tested queries in the mongo shell, I got confused because it seems like $near 2d legacy use degrees as distance measure.
- use degrees
db.restaurants.find({ ‘address.coord’ :{ $near : [ -73.9, 40.7 ], $maxDistance : 2/111.1 }}) #degrees
- use radians
db.restaurants.find({ ‘address.coord’ :{ $near : [ -73.9, 40.7 ], $maxDistance : 2/6378.1}} ) #radians
I checked that the first query with degrees gave correct answer, not the second one with radians.
Does $near 2d legacy use degrees or radians as distance measure?
Is there anyone who can solve my problem?
Thanks.