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

Mixing $geoWithin queries can causes an error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.5.5
    • 2.6.0-rc0
    • Geo
    • None
    • Fully Compatible
    • ALL
    • Hide

      db.geo.drop()
      db.geo.insert( { type: "house", loc : { type : "Point", coordinates : [ 71.0603, 42.3583 ] } })
      db.geo.insert( { type: "flat",  loc : { type : "Point", coordinates : [ 87.6500, 41.8500 ] } })
       
      db.geo.ensureIndex({loc: "2dsphere", type: 1});
       
      // Query using $box
      db.geo.find({loc: {
          $geoWithin: {
              $box: [[-180, -90], [180, 90]]
          }
      }, type: "house"}).explain()
       
       
      // Query using $geomerty
      db.geo.find( { loc :
        { $geoWithin :
          { $geometry :
            { type : "Polygon" ,
              coordinates : [[ [-180, -90], [180, -90], [180, 90],
                              [-180, -90] ] ]
        } } },
        type: "house" } ).explain()
       
      // Trying the initial query and BOOM
      // Query using $box
      db.geo.find({loc: {
          $geoWithin: {
              $box: [[-180, -90], [180, 90]]
          }
      }, type: "house"}).explain()

      Show
      db.geo.drop() db.geo.insert( { type: "house", loc : { type : "Point", coordinates : [ 71.0603, 42.3583 ] } }) db.geo.insert( { type: "flat", loc : { type : "Point", coordinates : [ 87.6500, 41.8500 ] } })   db.geo.ensureIndex({loc: "2dsphere", type: 1});   // Query using $box db.geo.find({loc: { $geoWithin: { $box: [[-180, -90], [180, 90]] } }, type: "house"}).explain()     // Query using $geomerty db.geo.find( { loc : { $geoWithin : { $geometry : { type : "Polygon" , coordinates : [[ [-180, -90], [180, -90], [180, 90], [-180, -90] ] ] } } }, type: "house" } ).explain()   // Trying the initial query and BOOM // Query using $box db.geo.find({loc: { $geoWithin: { $box: [[-180, -90], [180, 90]] } }, type: "house"}).explain()

    Description

      Mixing a $box and a $geometry query can cause an error:

      Shell:

      2014-02-14T11:31:04.187+0000 error: { "$err" : "assertion src/mongo/db/geo/geoquery.cpp:904" } at src/mongo/shell/query.js:131

      Logs:

      2014-02-14T11:39:37.144+0000 [conn1] test.geo Assertion failure NULL != _polygon src/mongo/db/geo/geoquery.cpp 904
      2014-02-14T11:39:37.154+0000 [conn1] test.geo 0x115c4d1 0x10ff4b9 0x10e358e 0xb12f8b 0xcf420b 0xd2a0ef 0xd2ac6a 0xd2c644 0xd2cc0f 0xd3b949 0xd3c0e5 0xce23b7 0xce4b66 0xd0cc2c 0xb63ba2 0xb65212 0x75fd37 0x111331b 0x7fd6e6a77e9a 0x7fd6e5d8accd
       /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x115c4d1]
       /usr/bin/mongod(_ZN5mongo10logContextEPKc+0x159) [0x10ff4b9]
       /usr/bin/mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x17e) [0x10e358e]
       /usr/bin/mongod() [0xb12f8b]
       /usr/bin/mongod(_ZN5mongo18IndexBoundsBuilder9translateEPKNS_15MatchExpressionERKNS_11BSONElementERKNS_10IndexEntryEPNS_19OrderedIntervalListEPNS0_15BoundsTightnessE+0x1fdb) [0xcf420b]
       /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess12makeLeafNodeERKNS_14CanonicalQueryERKNS_10IndexEntryEmPNS_15MatchExpressionEPNS_18IndexBoundsBuilder15BoundsTightnessE+0x28f) [0xd2a0ef]
       /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess17processIndexScansERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EEPS6_IPNS_17QuerySolutionNodeESaISD_EE+0x27a) [0xd2ac6a]
       /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess15buildIndexedAndERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0x54) [0xd2c644]
       /usr/bin/mongod(_ZN5mongo18QueryPlannerAccess22buildIndexedDataAccessERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0x19f) [0xd2cc0f]
       /usr/bin/mongod(_ZN5mongo12QueryPlanner13planFromCacheERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsERKNS_17SolutionCacheDataEPPNS_13QuerySolutionE+0x679) [0xd3b949]
       /usr/bin/mongod(_ZN5mongo12QueryPlanner13planFromCacheERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsERKNS_14CachedSolutionEPPNS_13QuerySolutionESC_+0x85) [0xd3c0e5]
       /usr/bin/mongod(_ZN5mongo9getRunnerEPNS_10CollectionEPNS_14CanonicalQueryEPPNS_6RunnerEm+0xff7) [0xce23b7]
       /usr/bin/mongod(_ZN5mongo9getRunnerEPNS_14CanonicalQueryEPPNS_6RunnerEm+0x96) [0xce4b66]
       /usr/bin/mongod(_ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5Cur

      Attachments

        Issue Links

          Activity

            People

              benety.goh@mongodb.com Benety Goh
              ross@mongodb.com Ross Lawley
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: