Simplify elemMatch expressions containing one single trivially false component to alwaysFalse

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • 120
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The definition of an $elemMatch expression is that it matches docs in where all its components are true, hence as soon as one is false the doc is filtered out.

      That means we can optimize

      $elemMatch: [{a: 1}, {$alwaysFalse: 1}]

      to

      $alwaysFalse: 1

            Assignee:
            Carlos Alonso Pérez
            Reporter:
            Carlos Alonso Pérez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: