Description
I'm trying to find documents containing an array with equal values at positions 0 and 1. This query produces all documents in the collection:
db.collection.find({
|
$expr: {
|
$eq: ["$arr.0", "$arr.1"]
|
}
|
})
|
(see this MongoPlayground)
Is it documented somewhere that Expressions don't support array index dot notation? They do support object dot notation field paths.
More discussion in this SO Q&A, in which user Ashh claimed that `"You cannot use field names inside the expr"`, but I couldn't figure out if they were quoting some official docs, and the ensuing discussion ended up being rather confusing.
Scope of changes
- Investigate behavior of `$expr` with `$eq` and array index dot notation
- Update documentation as appropriate
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
|