-
Type:
Improvement
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: 4.0.8
-
Component/s: Aggregation Framework, Querying
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In a Change Stream pipeline, we would like to refer to updated fields in
embedded documents, e.g. updateDescription: { updatedFields: { "a.b.c": "Foo" } }.
But field path expressions cannot refer to such fields because they contain
dots, and field path expressions lack an escape-character; for example like
"$updateDescription.updatedFields.a..b..c".
A workaround for some scenarios is to use the full-document option to have MongoDB
lookup the document and include it in the result, but this incurs a performance-cost
and may return the document in a different state; both of which make the workaround unsuitable for our use-case.
{
"_id": { "_data": /**/ },
"operationType": "update",
"ns": { "db": "test", "coll": "test" },
"documentKey": { "_id": /**/ },
"updateDescription": {
"updatedFields": { "a.b.c": "Foo" },
"removedFields": []
}
}
changeStream = db.test.watch(
[
{
$project: {
c: "$updateDescription.updatedFields.a.b.c"
}
}
]
);
- duplicates
-
SERVER-21889 Oplog format for $set operations on subdocuments creates format that is not queryable
-
- Backlog
-