$elemMatch + $not should be able to use index scan

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Critical - P2
    • 9.0.0-rc0, 8.3.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • Fully Compatible
    • ALL
    • v8.3, v8.2, v8.0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Looks likeĀ SERVER-78260 completely disabled the use of index scans for queries of the form {$elemMatch: {$not: ...}}, regardless of whether or not they participated in the "contained $or pushdown" rewrite.

      In principle, for a filter like {a: {$elemMatch: {b: {$not: {$eq: 1}}}, we should be able to use the index bounds [MinKey, 1) (1, MaxKey] on index field a.b, then filter out documents using the $elemMatch predicate. We should restore this behaviour outside of the contained $or case described in SERVER-78260.

            Assignee:
            Alya Berciu
            Reporter:
            Alya Berciu
            Votes:
            1 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: