2.6 strictly enforces that a $where query operator must be a field of the top-level document. It cannot be inside a nested document (for instance, below an $elemMatch). Can we add this as a note here: http://docs.mongodb.org/manual/reference/operator/query/where/?
2.4 erroneously allowed $where inside an $elemMatch value, so it might be worth tagging this as "changed in 2.6".
See relevant core server tickets for details: SERVER-13503, SERVER-12439, and SERVER-14010.
- related to
-
SERVER-12439 $where in $elemMatch no longer valid in 2.5.5-pre
- Closed
-
SERVER-13503 The $where operator should not be allowed under $elemMatch
- Closed
-
SERVER-14010 Use of $where within $elemMatch
- Closed