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

$within:$center returns documents outside of the given circle

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.4
    • Affects Version/s: 1.5.2
    • Component/s: Geo
    • None

      The first command returns a document which is outside of the given circle. Decreasing the radius doesn't help.
      > db.aggregates.find({position:{$within:{$center:[[46.16760025, 8.79330351666667],0.00001]}}})

      { "_id" : ObjectId("4c07ca39f18d653fb9000001"), "position" : [ 46.16997015, 8.799318833333333 ] }

      The geoNear command returns the same object but calculates a distance which is higher than the radius used in the above command.
      > db.runCommand(

      { geoNear : "aggregates" , near : [46.16760025, 8.79330351666667], num : 1 }

      );
      {
      "ns" : "myway.aggregates",
      "near" : "1100100000010100101100100010000011010000101110010100",
      "results" : [
      {
      "dis" : 0.0064640792077458676,
      "obj" :

      { "_id" : ObjectId("4c07ca39f18d653fb9000001"), "position" : [ 46.16997015, 8.799318833333333 ] }

      }
      ],
      "stats" :

      { "time" : 0, "btreelocs" : 0, "nscanned" : 1, "objectsLoaded" : 1, "avgDistance" : 0.0064640792077458676 }

      ,
      "ok" : 1
      }
      >

            Assignee:
            richard.kreuter Richard Kreuter (Inactive)
            Reporter:
            werehamster Tomas Carnecky
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: