Details
-
Task
-
Resolution: Won't Fix
-
Major - P3
-
3.6 Core Server
-
None
-
1
Description
Regarding the following page:
https://docs.mongodb.com/master/reference/operator/query/expr
Please add a section that describes $expr index use limitations. When $expr is used within a query or aggregation $match stage, we will attempt to rewrite the aggregation expression to a match language expression. This rewrite when possible allows for participation on query planning and index selection. We support comparison expressions (outside of $cmp which has no match equivalent) and $in for rewrite.
We do not however support rewrite / index use for local document dotted field paths in $expr. The reason for this is dotted field paths in the Aggregation language are not evaluate in the same manner as in the match language. This prevents us from performing a rewrite without impacting correctness. As a workaround (which won't be possible for all $expr use cases) users can supplement the $expr statement with indexed match language statements to filter.
For $lookup users, we continue to support localField/foreignField syntax, which will use indexes in the same manner it does in 3.4.