Skip to content

Commit d9d371b

Browse files
authored
test(NODE-7147): Revert field presence changes from server 8.2.0 (#4928)
1 parent 1e0dfda commit d9d371b

2 files changed

Lines changed: 123 additions & 3 deletions

File tree

test/spec/change-streams/unified/change-streams-disambiguatedPaths.json

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,91 @@
4242
}
4343
],
4444
"tests": [
45+
{
46+
"description": "disambiguatedPaths is not present when showExpandedEvents is false/unset",
47+
"runOnRequirements": [
48+
{
49+
"minServerVersion": "6.1.0",
50+
"maxServerVersion": "8.1.99",
51+
"topologies": [
52+
"replicaset",
53+
"load-balanced",
54+
"sharded"
55+
],
56+
"serverless": "forbid"
57+
},
58+
{
59+
"minServerVersion": "8.2.1",
60+
"topologies": [
61+
"replicaset",
62+
"load-balanced",
63+
"sharded"
64+
],
65+
"serverless": "forbid"
66+
}
67+
],
68+
"operations": [
69+
{
70+
"name": "insertOne",
71+
"object": "collection0",
72+
"arguments": {
73+
"document": {
74+
"_id": 1,
75+
"a": {
76+
"1": 1
77+
}
78+
}
79+
}
80+
},
81+
{
82+
"name": "createChangeStream",
83+
"object": "collection0",
84+
"arguments": {
85+
"pipeline": []
86+
},
87+
"saveResultAsEntity": "changeStream0"
88+
},
89+
{
90+
"name": "updateOne",
91+
"object": "collection0",
92+
"arguments": {
93+
"filter": {
94+
"_id": 1
95+
},
96+
"update": {
97+
"$set": {
98+
"a.1": 2
99+
}
100+
}
101+
}
102+
},
103+
{
104+
"name": "iterateUntilDocumentOrError",
105+
"object": "changeStream0",
106+
"expectResult": {
107+
"operationType": "update",
108+
"ns": {
109+
"db": "database0",
110+
"coll": "collection0"
111+
},
112+
"updateDescription": {
113+
"updatedFields": {
114+
"$$exists": true
115+
},
116+
"removedFields": {
117+
"$$exists": true
118+
},
119+
"truncatedArrays": {
120+
"$$exists": true
121+
},
122+
"disambiguatedPaths": {
123+
"$$exists": false
124+
}
125+
}
126+
}
127+
}
128+
]
129+
},
45130
{
46131
"description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present",
47132
"operations": [
@@ -184,4 +269,4 @@
184269
]
185270
}
186271
]
187-
}
272+
}

test/spec/change-streams/unified/change-streams-disambiguatedPaths.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ createEntities:
1515

1616
runOnRequirements:
1717
- minServerVersion: "6.1.0"
18-
topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ]
18+
topologies: [ replicaset, load-balanced, sharded ]
1919
serverless: forbid
2020

2121
initialData:
@@ -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
@@ -74,4 +109,4 @@ tests:
74109
updatedFields: { $$exists: true }
75110
removedFields: { $$exists: true }
76111
truncatedArrays: { $$exists: true }
77-
disambiguatedPaths: { 'a.0.1': ['a', { $$type: 'int' }, '1'] }
112+
disambiguatedPaths: { 'a.0.1': ['a', { $$type: 'int' }, '1'] }

0 commit comments

Comments
 (0)