Allow $expr splitting for $match pushdown past $group

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      aggregate([
          {$group: {_id: "$x", count: {$sum: 1}}},
          {$match: {$expr: {$and: [{$eq: ["$_id", 3]}, {$eq: [{$type: "$count"}, "double"]}]}}}
      ])
      

      The above $expr has a part which can be pushed down past $match. 

      The existing logic added in SERVER-112772 does consider this predicate permissable for pushdown due to the strict allow-list nature of the check and the presence of the $type expression.

      We have code to do $expr splitting and we could allow for this pushdown.

            Assignee:
            Unassigned
            Reporter:
            Vesko Karaganev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: