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

Simplify elemMatch expressions containing one single trivially false component to alwaysFalse

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

      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:
            c.alonso@mongodb.com Carlos Alonso Pérez
            Reporter:
            c.alonso@mongodb.com Carlos Alonso Pérez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: