A change stream pipeline with empty field path match expression causes tripwire failure. For example:
db.test.aggregate([{$changeStream:{ fullDocument: 'updateLookup' }}, {"$match":{"":null}}])
The rewrite failure:
Error: command failed: { "ok" : 0, "errmsg" : "Failed to optimize pipeline :: caused by :: Unexpected empty path", "code" : 5687201, "codeName" : "Location5687201" }
However, It is actually valid to have an empty field match expression. Removing $changeStream stage returns the results matching the expression in the collection:
db.test.insert({"": 123}) // not to be returned db.test.insert({a: 10}) // to be returned db.test.aggregate([{"$match":{"":null}}]) // returns {a: 10}
We need to fix and relax the restriction to allow empty field path matching.
- is related to
-
SERVER-56872 Add optimization function to apply $match predicates on change streams events directly to oplog entry
- Closed