SERVER-134593ClosedDuplicate
Add basic matcher path traversal and narrowing
Type matcher::traversePath(Type input, ElementPath, Type constraint, bool assumeTrue); Type matcher::narrowPath(Type input, ElementPath, Type constraint, bool assumeTrue); PathMatchExpressions such as TypeMatchExpression use ElementPath to describe how they match on a match. The ElementPath has two enums: * LeafArrayBehavior - whether we can match within leaf array like \{$match: {x: 1}} will match 1 inside 'x' if 'x' is array. * NonLeafArrayBehavior - whether we can traverse array