-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 6.0.5
-
Component/s: None
-
Query Execution
-
ALL
-
The DocumentKey field of the change event does not capture a shard key if the value of the shard key is null.
Consider a collection emp with a shard key name.
Inserting a document with no value for name, like
{{db.emp.insertOne({"_id":"1001"})
}}produces a change event with DocumentKey that contains only the _id field
fullDocument=Document{{_id=1002, documentKey={"_id": "1001"}}}
Similarly, updating the name field does not have the previous value of the shard key in the document key. That is,
db.emp.updateOne({"_id":"1001","name":null},{$set:{"name":"Adam") }}also produces a change event with DocumentKey that contains only the _id field{{{}
documentKey={"_id": "1001"}, updateDescription=UpdateDescription{removedFields=[], updatedFields=
, truncatedArrays=[]}{}}}
In both these operations, the DocumentKey field should contain a field for the name as well, like documentKey={"_id": "1001", "name": null}
In our use case, we rely on the DocumentKey field to know the shard keys and their previous values. As a workaround we couldn't depend on retrieving the shard key from the config database when Change Streams is run as there is a possibility shard keys may have been refined between when the operation was performed and Change Streams was run.
Expected behavior:
Provide all the shard keys in DocumentKey even if their value is null.
- is related to
-
SERVER-75607 Change Stream: Shard keys not captured in documentKey on delete operations performed directly on mongo instances
- Closed