Skip to content

Commit 6650c98

Browse files
authored
DRIVERS-3278 Revert field presence changes from server 8.2.0 (#1913)
1 parent cadc072 commit 6650c98

3 files changed

Lines changed: 134 additions & 4 deletions

File tree

source/change-streams/change-streams.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,15 @@ class ChangeStreamDocument {
138138
to: Optional<Document>;
139139

140140
/**
141-
* Only present for ops of type 'rename', 'create', 'modify', 'createIndexes', 'dropIndexes', 'shardCollection', 'reshardCollection', 'refineCollectionShardKey'.
142-
* Prior to server version 8.2.0, only present when the `showExpandedEvents` change stream option is enabled.
141+
* * Only present when the `showExpandedEvents` change stream option is enabled and for the following events:
142+
* - 'rename'
143+
* - 'create'
144+
* - 'modify'
145+
* - 'createIndexes'
146+
* - 'dropIndexes'
147+
* - 'shardCollection'
148+
* - 'reshardCollection'
149+
* - 'refineCollectionShardKey'
143150
*
144151
* A description of the operation.
145152
*
@@ -202,7 +209,7 @@ class ChangeStreamDocument {
202209
/**
203210
* The `ui` field from the oplog entry corresponding to the change event.
204211
*
205-
* Only present for the following events:
212+
* Only present when the `showExpandedEvents` change stream option is enabled and for the following events:
206213
* - 'insert'
207214
* - 'update'
208215
* - 'delete'
@@ -214,7 +221,6 @@ class ChangeStreamDocument {
214221
* - 'shardCollection'
215222
* - 'reshardCollection'
216223
* - 'refineCollectionShardKey'
217-
* Prior to server versions 8.2, only present when the `showExpandedEvents` change stream option is enabled.
218224
*
219225
* This field is a value of binary subtype 4 (UUID).
220226
*
@@ -299,6 +305,8 @@ class UpdateDescription {
299305
*
300306
* In each array, all elements will be returned as strings with the exception of array indices, which will be returned as 32 bit integers.
301307
*
308+
* Only present when the `showExpandedEvents` change stream option is enabled.
309+
*
302310
* @since 6.1.0
303311
*/
304312
disambiguatedPaths: Optional<Document>
@@ -1026,6 +1034,8 @@ There should be no backwards compatibility concerns.
10261034

10271035
## Changelog
10281036

1037+
- 2026-03-18: Revert expanded field visibility change.
1038+
10291039
- 2025-09-08: Clarify resume behavior.
10301040

10311041
- 2025-03-31: Update for expanded field visibility in server 8.2+

source/change-streams/tests/unified/change-streams-disambiguatedPaths.json

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/change-streams/tests/unified/change-streams-disambiguatedPaths.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,41 @@ initialData:
2424
documents: []
2525

2626
tests:
27+
- description: "disambiguatedPaths is not present when showExpandedEvents is false/unset"
28+
# skip server version 8.2.0, which emits disambiguatedPaths unconditionally
29+
runOnRequirements:
30+
- minServerVersion: "6.1.0"
31+
maxServerVersion: "8.1.99"
32+
topologies: [ replicaset, load-balanced, sharded ]
33+
serverless: forbid
34+
- minServerVersion: "8.2.1"
35+
topologies: [ replicaset, load-balanced, sharded ]
36+
serverless: forbid
37+
operations:
38+
- name: insertOne
39+
object: *collection0
40+
arguments:
41+
document: { _id: 1, 'a': { '1': 1 } }
42+
- name: createChangeStream
43+
object: *collection0
44+
arguments: { pipeline: [] }
45+
saveResultAsEntity: &changeStream0 changeStream0
46+
- name: updateOne
47+
object: *collection0
48+
arguments:
49+
filter: { _id: 1 }
50+
update: { $set: { 'a.1': 2 } }
51+
- name: iterateUntilDocumentOrError
52+
object: *changeStream0
53+
expectResult:
54+
operationType: "update"
55+
ns: { db: *database0, coll: *collection0 }
56+
updateDescription:
57+
updatedFields: { $$exists: true }
58+
removedFields: { $$exists: true }
59+
truncatedArrays: { $$exists: true }
60+
disambiguatedPaths: { $$exists: false }
61+
2762
- description: "disambiguatedPaths is present on updateDescription when an ambiguous path is present"
2863
operations:
2964
- name: insertOne

0 commit comments

Comments
 (0)