1

i have following kind of records in mongodb

{
  "user_id" : 79102,
  "country_code" : "OR",
  "location" : [43.831111, -121.4912121]
}

so when i use command geoNear then its giving me distance but somebody can tell me which unit distance is calculated using geospacial index? Is it in km, m, miles ?? Please help me

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
JMohasin
  • 513
  • 2
  • 13
  • 35

1 Answers1

1

As mentioned here :

http://www.mongodb.org/display/DOCS/Geospatial+Indexing#GeospatialIndexing-geoNearCommand

MongoDB geo distance/radius to useful units

All distances use radians. This allows you to easily multiply by the radius of the earth (about 6371 km or 3959 miles) to get the distance in your choice of units. Conversely, divide by the radius of the earth when doing queries. We don't currently handle wrapping at the poles or at the transition from -180° to +180° longitude, however we detect when a search would wrap and raise an error. While the default Earth-like bounds are [-180, 180), valid values for latitude are between -90° and 90°.

Community
  • 1
  • 1
DhruvPathak
  • 42,059
  • 16
  • 116
  • 175