1

I am getting wrong distance using mongodb geonear query. What I have done till now.

  1. Saved the lat-long as
    "Coordinates" : { "Longitude" : 174.811937, "Latitude" : -36.880177 }

  2. Created 2d Index on Coordinates field of collection

  3. distance returned is "distance": 253.33004896638525

I also tried 2dsphere index but result is same. Please let me know if anything that i am missing

db.collection('RestaurentMaster').aggregate([{
    $geoNear : {
        near : [174.780599, -36.855702],
        distanceMultiplier : 6371,
        distanceField : "distance",
        spherical : false,
        limit : 10,
        query : {...}
    }
}])
Kirill
  • 2,590
  • 1
  • 17
  • 16
user7420795
  • 199
  • 1
  • 15

0 Answers0