Currently it raises an assertion and fails the query as it tries to optimize this. I think this is a simple case to fix to just abandon optimization.
I also think that I introduced this accidentally during a refactor in https://github.com/mongodb/mongo/commit/0e967d6ed33cdf9eb8314e6ae3fb3e2261e213d7 (SERVER-53638)
- causes
-
SERVER-65701 Avoid running expr.js in multiversion suites
- Closed
- is duplicated by
-
SERVER-71045 Use of $$ROOT in $expr in $match fails on servers prior to 6.0
- Closed