Server crash when a predicate inside $elemMatch value is not indexable

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.6.0-rc3
    • Affects Version/s: 2.5.5, 2.6.0-rc1
    • Component/s: Querying
    • Environment:
      mac os x
    • OS X
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The $elemMatch value is considered indexable, causing the server to erroneously try to build index bounds for the "$size: 3" predicate.

      > t = db.t
      test.t
      > t.drop()
      2014-03-21T14:16:28.601-0400 trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
      2014-03-21T14:16:28.602-0400 reconnect 127.0.0.1:27017 (127.0.0.1) ok
      true
      > t.ensureIndex({a: 1})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > t.find({a: {$elemMatch: {$size: 3, $gt: 2}}})
      2014-03-21T14:17:02.525-0400 DBClientCursor::init call() failed
      Error: error doing query: failed
      

              Assignee:
              David Storch
              Reporter:
              Steve Duan
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: