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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.6.0
    • None
    • Querying
    • None
    • Query
    • ALL

    Description

      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)
      >
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: