Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13538

Inconsistent geoNear result for MongoDB 2.6.0 and MongoDB 2.4.10

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.6.0
    • Component/s: Geo
    • None
    • ALL
    • Hide

      run these commands on MongoDB 2.4.10 and 2.6.0

      db.runCommand({ dropIndexes: "location", index: "*" })
      db.location.drop();
      db.location.save({"_id":1, "position" : [-74.044628, 40.689182]})
      db.location.save({"_id":2, "position" : [-74.041243, 40.700309]})
      db.location.ensureIndex( {position: "2dsphere"} )
      db.runCommand( { geoNear : "location" , near : { type : "Point" , coordinates: [-74.045255, 40.702554] } , spherical : true } ).results[0].dis
      
      Show
      run these commands on MongoDB 2.4.10 and 2.6.0 db.runCommand({ dropIndexes: "location" , index: "*" }) db.location.drop(); db.location.save({ "_id" :1, "position" : [-74.044628, 40.689182]}) db.location.save({ "_id" :2, "position" : [-74.041243, 40.700309]}) db.location.ensureIndex( {position: "2dsphere" } ) db.runCommand( { geoNear : "location" , near : { type : "Point" , coordinates: [-74.045255, 40.702554] } , spherical : true } ).results[0].dis

      geoNear is reporting slightly different result on same dataset depending on the MongoDB version.
      geoNear on a GeoJSON differ after the 3rd decimal point.

      420.8260 rounded to 4 decimal points (2.6.0)
      420.8223 rounded to 4 decimal points (2.4.10)

            Assignee:
            Unassigned Unassigned
            Reporter:
            blacksnow666 Titi Wangsa Damhore
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: