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

$geoWithin query doesn't return a point on the pole with 2dsphere index

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Geo, Querying
    • Labels:
    • ALL

      Doing a $geoWithin query on a point at the pole returns results in 2.5.5-pre, but not if a 2dsphere index is raised.

      2.5.5-pre:

      > db.repro.insert("loc" : [ 25, 90 ])
      SingleWriteResult({
              "writeErrors" : [ ],
              "writeConcernErrors" : [ ],
              "nInserted" : 1,
              "nUpserted" : 0,
              "nUpdated" : 0,
              "nModified" : 0,
              "nRemoved" : 0,
              "upserted" : [ ]
      })
      > db.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
      { "_id" : 0, "loc" : { "type" : "Point", "coordinates" : [ 25, 90 ] } }
      >
      > db.repro.ensureIndex({loc:"2dsphere"})
      > db.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
      > db.repro.dropIndexes()
      > db.repro.ensureIndex({loc:"2d"})
      > db.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
      { "_id" : 0, "loc" : { "type" : "Point", "coordinates" : [ 25, 90 ] } }
      > db.runCommand({"buildinfo":1}).gitVersion
      f65a0b814b8c77e3fbe90bca0c061c9b77f6acdb
      

      Separately, in 2.4.9, the document is not found at all:

      > mydb.repro.insert(x)
      > mydb.repro.find({loc: {$geoWithin: {$geometry: {type: "Polygon", coordinates: [[[180,90], [180,0], [0,0], [180,90]]]}}}})
      >
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: