|
When SBE was first implemented, it supported execution of $elemMatch value expressions. We still have plenty of code to handle translation of $elemMatch value to an SBE plan (see here).
We subsequently made a change in SERVER-57854 to fallback to the classic engine when there are predicates over empty field names. This is implemented by marking the query SBE-incompatible if any path predicate with an empty path is detected. This had the unintended side effect of preventing queries involving $elemMatch value from ever executing in SBE. The reason (as noted in SERVER-59757) is that the match expression parser internally creates predicates with empty field names as part of constructing the MatchExpression tree to represent an $elemMatch value.
This isn't technically a correctness bug, but it does leave the code base in a confusing state. The code appears to support $elemMatch value in SBE, but in fact it does not. The work for this ticket is to restore $elemMatch value support in SBE via the stage builders (or potentially delete the dead stage builder code?).
|