I can’t seem to find this information. But using a geo search you can specify $maxDistance but for the life of me, I can’t find if that is miles, kilometers, etc.
Here is a sample query I’m using:
db.hotels.find( { location: { $near : [18.74255, 99.03523], $maxDistance : 0.05 } } ).count()
Returns 15 (from my hotels database).
Thanks for any information.
Unless you’re doing a spherical query (like
$nearSphere), MongoDB doesn’t actually care about units, it just treats your locations as Cartesian coordinates.So, the calculated distance is going to be in whatever your input units were. Since your
$nearpoint looks like standard lat/long, the$maxDistancein this case will be in units of degrees.