-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Change streams
-
None
-
Query Execution
-
Fully Compatible
-
QE 2025-05-12, QE 2025-05-26, QE 2025-06-09
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
0
The change stream match expression rewrites for update and replace operations are:
update: {op: "u", "o._id": {$exists: false}}
replace: {op: "u", "o._id": {$exists: true}}
When a change stream matches both updates and replaces, this will result in a match expression such as
{
$or: [
...
{
op: "u",
"o._id": {
$exists: false
}
},
{
op: "u",
"o._id": {
$exists: true
}
},
...
]
}
This is verbose and inefficient.
Instead, the two conditions can be fused to a single, simpler condition
{
op: "u"
}
This also allows further optimizations so that the single op type match can be fused with other op type matches into a single IN list match for the op type, e.g.
{
op: {
$in: [
"d",
"i",
"u"
]
}
}
- is related to
-
SERVER-105955 Revert SERVER-105199
-
- Closed
-