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

Matcher incorrect on null equality query when using array index notation with embedded field

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0
    • Component/s: Querying
    • None
    • Query
    • ALL

      Queries of the form {"a.0.b": null} incorrectly match documents where "a" is an array such that the first element is a subdocument with a non-null value for "b".

      Regression since 2.4. Affects 2.6.0 through 2.6.4.

      Example repro:

      > db.version()
      2.6.4
      > db.test.drop()
      true
      > db.test.insert({a:[{b:1}]})
      > db.test.find({"a.0.b":null}) // incorrect: document should not be returned
      { "_id" : ObjectId("53eab15e36fe6f6cc7dd5e68"), "a" : [  {  "b" : 1 } ] }
      > db.test.ensureIndex({"a.0.b":1})
      > db.test.find({"a.0.b":null}) // correct: document not returned (matcher bypassed)
      >
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            rassi J Rassi
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: