SERVER-31760 it's possible to rewrite $expr with $in expression to an indexable MatchExpression.
Semanticallyis exactly equivalent to if value is not an array.
If we restrict using an index for $expr $in expressions to non-multikey indexes/paths, then we will only get back matches from the index that are guaranteed to be correct semantically to the aggregation meaning of $in.
This is also exactly equivalent query that can use any index and return only agg semantics:
The second part prevents reaching into arrays for comparison.