-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
The fix for SERVER-57588 is to check if an $elemMatch is on a field which is a positional path component of an indexed path. If that is the case, the index cannot be used for $elemMatch because key boundaries cannot be formed. The problem with that patch is that it is too crude, and may prevent index use even when the parent path doesn't contain arrays. In this case the positional path is not an array index, it has the meaning of a regular path, and the index can still be used.
In order to refine that patch, and make multikeyness index metadata more complete, it is necessary to simplify the metadata and collect multikey information even when the index path contains positional components.