-
Type: Task
-
Resolution: Gone away
-
Priority: Trivial - P5
-
Affects Version/s: 4.2.3
-
Component/s: Server
-
Labels:
-
Environment:windows 10
Description
In the below link, I found that $near 2d legacy use radians as distance measure.
https://docs.mongodb.com/manual/reference/operator/query/near/
{ $near: [ <x>, <y> ], $maxDistance: <distance in radians> }However, when I tested queries in the mongo shell, I got confused because it seems like $near 2d legacy use degrees as distance measure.
1. use degrees
db.restaurants.find({ 'address.coord' :
{ $near : [ -73.9, 40.7 ], $maxDistance : 2/111.1 }} ) #degrees
2. 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.
Is there anyone who can solve my problem?