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

[SBE] $elemMatch with object filter returns no documents

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Query Execution 2021-03-08, Query Execution 2021-03-22
    • 167

       

      > db.test.find()
      { "_id" : ..., "a" : [ ] }
      { "_id" : ..., "a" : [ 1, 2, 3 ] }
      { "_id" : ..., "a" : [ {c: 1} ] }

       

      [Classic Engine]
      > db.test.find({a: {$not: {$elemMatch: {b: 1}}}}).toArray()
      [
       { "_id" : ..., "a" : [ ] },
       { "_id" : ..., "a" : [ 1, 2, 3 ] },
       { "_id" : ..., "a" : [ {c: 1} ] }
      ]
      

       

      [SBE]
      > db.test.find({a: {$not: {$elemMatch: {b: 1}}}}).toArray()
      [ ]
      

       

            Assignee:
            andrew.paroski@mongodb.com Drew Paroski
            Reporter:
            nikita.lapkov@mongodb.com Nikita Lapkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: