-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
-
Query Execution
-
QE 2021-11-15, QE 2021-11-29, QE 2021-12-27, QE 2022-01-10, QE 2022-04-04, QE 2022-02-07, QE 2022-02-21, QE 2022-03-07, QE 2022-03-21, QE 2022-01-24
If a $match (with $expr) stage isn't a source stage after the rewrite, we could avoid building a 'MatchExpression' for the query inside the $match and directly evaluate the aggregate expression inside DocumentSourceMatch stage itself. The main advantage of doing this is that we avoid unnecessary transformation of Document -> BSONObj -> Document, that happens in DocumentSourceMatch stage for each document.