MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

$near 2d legacy distance measure

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: [ , ], $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.

  1. use degrees

db.restaurants.find({ ‘address.coord’ :{ $near : [ -73.9, 40.7 ], $maxDistance : 2/111.1 }}) #degrees

  1. 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.