-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
traversePath only covers one-element paths and kTraverse (the basic cases needed for $type) from SERVER-134593.
This is a dedicated ticket to extend it to cover all cases. That means dotted paths, the three LeafArrayBehavior and three NonLeafArrayBehavior.
It is expected that in many practical cases, there isn't a better result to return that 'any', but we should ensure that when we can produce an exact result, we do, and we do not construct cases where the output paradoxically becomes wider than the input (the opposite of constraining it).
The BSONElementIterator class and other logic in src/mongo/db/matcher/path.cpp holds the execution code that we are trying to type, so we should use that as a guide. That code shows exactly what kMatchSubpath does for example.