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

$not expression inside $elemMatch causes assertion error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.0-rc0
    • Affects Version/s: 2.5.5
    • Component/s: Querying
    • Environment:
      mac os x
    • OS X

       { a: { $elemMatch: { $gt:4, $not: { $gte:6 } } } } 

      A query like the one above that runs $not inside of an $elemMatch expression will cause the db to verify(0) when it attempts to build index bounds for the query.

      Assertion failure 0 src/mongo/db/query/index_bounds_builder.cpp 447
      0x10063f1fb 0x1005f7fc2 0x1005e8a12 0x10037aaa7 0x100379256 0x10039cfd8 0x10039da8b 0x1003a92c8 0x100370306 0x100370f2e 0x1002b25cd 0x10019dd04 0x100198ba5 0x1001997fd 0x10019a41c 0x100386573 0x1002630f6 0x100006f24 0x1006056b1 0x100673e55 
       0   mongod                              0x000000010063f1fb _ZN5mongo15printStackTraceERSo + 43
       1   mongod                              0x00000001005f7fc2 _ZN5mongo10logContextEPKc + 114
       2   mongod                              0x00000001005e8a12 _ZN5mongo12verifyFailedEPKcS1_j + 274
       3   mongod                              0x000000010037aaa7 _ZN5mongo18IndexBoundsBuilder9translateEPKNS_15MatchExpressionERKNS_11BSONElementERKNS_10IndexEntryEPNS_19OrderedIntervalListEPNS0_15BoundsTightnessE + 6605
       4   mongod                              0x0000000100379256 _ZN5mongo18IndexBoundsBuilder9translateEPKNS_15MatchExpressionERKNS_11BSONElementERKNS_10IndexEntryEPNS_19OrderedIntervalListEPNS0_15BoundsTightnessE + 380
       5   mongod                              0x000000010039cfd8 _ZN5mongo18QueryPlannerAccess12makeLeafNodeERKNS_14CanonicalQueryERKNS_10IndexEntryEPNS_15MatchExpressionEPNS_18IndexBoundsBuilder15BoundsTightnessE + 1984
       6   mongod                              0x000000010039da8b _ZN5mongo18QueryPlannerAccess22buildIndexedDataAccessERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE + 285
       7   mongod                              0x00000001003a92c8 _ZN5mongo12QueryPlanner4planERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsEPSt6vectorIPNS_13QuerySolutionESaIS9_EE + 9246
       8   mongod                              0x0000000100370306 _ZN5mongo9getRunnerEPNS_10CollectionEPNS_14CanonicalQueryEPPNS_6RunnerEm + 3094
       9   mongod                              0x0000000100370f2e _ZN5mongo9getRunnerEPNS_14CanonicalQueryEPPNS_6RunnerEm + 158
       10  mongod                              0x00000001002b25cd _ZN5mongo8runCountERKSsRKNS_7BSONObjERSsRi + 1485
       11  mongod                              0x000000010019dd04 _ZN5mongo8CmdCount3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 296
       12  mongod                              0x0000000100198ba5 _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 37
       13  mongod                              0x00000001001997fd _ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 2593
       14  mongod                              0x000000010019a41c _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1388
       15  mongod                              0x0000000100386573 _ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1843
       16  mongod                              0x00000001002630f6 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1958
       17  mongod                              0x0000000100006f24 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 308
       18  mongod                              0x00000001006056b1 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1681
       19  mongod                              0x0000000100673e55 thread_proxy + 229
      2014-01-29T14:46:52.282-0500 count failed: {
      	"errmsg" : "exception: assertion src/mongo/db/query/index_bounds_builder.cpp:447",
      	"code" : 0,
      	"ok" : 0
      } at src/mongo/shell/query.js:188

        1. elemmatch_not_v2.js
          1 kB
        2. elemmatch_not.js
          0.6 kB

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: