Skip to content

Commit ca0ce93

Browse files
committed
PHPLIB-924: Tests for updateDescription disambiguatedPaths field on 6.1+
Synced with mongodb/specifications@046db44
1 parent a292d07 commit ca0ce93

File tree

1 file changed

+251
-0
lines changed

1 file changed

+251
-0
lines changed
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
{
2+
"description": "disambiguatedPaths",
3+
"schemaVersion": "1.3",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"useMultipleMongoses": false
9+
}
10+
},
11+
{
12+
"database": {
13+
"id": "database0",
14+
"client": "client0",
15+
"databaseName": "database0"
16+
}
17+
},
18+
{
19+
"collection": {
20+
"id": "collection0",
21+
"database": "database0",
22+
"collectionName": "collection0"
23+
}
24+
}
25+
],
26+
"runOnRequirements": [
27+
{
28+
"minServerVersion": "6.1.0",
29+
"topologies": [
30+
"replicaset",
31+
"sharded-replicaset",
32+
"load-balanced",
33+
"sharded"
34+
]
35+
}
36+
],
37+
"initialData": [
38+
{
39+
"collectionName": "collection0",
40+
"databaseName": "database0",
41+
"documents": []
42+
}
43+
],
44+
"tests": [
45+
{
46+
"description": "disambiguatedPaths is not present when showExpandedEvents is false/unset",
47+
"operations": [
48+
{
49+
"name": "insertOne",
50+
"object": "collection0",
51+
"arguments": {
52+
"document": {
53+
"_id": 1,
54+
"a": {
55+
"1": 1
56+
}
57+
}
58+
}
59+
},
60+
{
61+
"name": "createChangeStream",
62+
"object": "collection0",
63+
"arguments": {
64+
"pipeline": []
65+
},
66+
"saveResultAsEntity": "changeStream0"
67+
},
68+
{
69+
"name": "updateOne",
70+
"object": "collection0",
71+
"arguments": {
72+
"filter": {
73+
"_id": 1
74+
},
75+
"update": {
76+
"$set": {
77+
"a.1": 2
78+
}
79+
}
80+
}
81+
},
82+
{
83+
"name": "iterateUntilDocumentOrError",
84+
"object": "changeStream0",
85+
"expectResult": {
86+
"operationType": "update",
87+
"ns": {
88+
"db": "database0",
89+
"coll": "collection0"
90+
},
91+
"updateDescription": {
92+
"updatedFields": {
93+
"$$exists": true
94+
},
95+
"removedFields": {
96+
"$$exists": true
97+
},
98+
"truncatedArrays": {
99+
"$$exists": true
100+
},
101+
"disambiguatedPaths": {
102+
"$$exists": false
103+
}
104+
}
105+
}
106+
}
107+
]
108+
},
109+
{
110+
"description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present",
111+
"operations": [
112+
{
113+
"name": "insertOne",
114+
"object": "collection0",
115+
"arguments": {
116+
"document": {
117+
"_id": 1,
118+
"a": {
119+
"1": 1
120+
}
121+
}
122+
}
123+
},
124+
{
125+
"name": "createChangeStream",
126+
"object": "collection0",
127+
"arguments": {
128+
"pipeline": [],
129+
"showExpandedEvents": true
130+
},
131+
"saveResultAsEntity": "changeStream0"
132+
},
133+
{
134+
"name": "updateOne",
135+
"object": "collection0",
136+
"arguments": {
137+
"filter": {
138+
"_id": 1
139+
},
140+
"update": {
141+
"$set": {
142+
"a.1": 2
143+
}
144+
}
145+
}
146+
},
147+
{
148+
"name": "iterateUntilDocumentOrError",
149+
"object": "changeStream0",
150+
"expectResult": {
151+
"operationType": "update",
152+
"ns": {
153+
"db": "database0",
154+
"coll": "collection0"
155+
},
156+
"updateDescription": {
157+
"updatedFields": {
158+
"$$exists": true
159+
},
160+
"removedFields": {
161+
"$$exists": true
162+
},
163+
"truncatedArrays": {
164+
"$$exists": true
165+
},
166+
"disambiguatedPaths": {
167+
"a.1": [
168+
"a",
169+
"1"
170+
]
171+
}
172+
}
173+
}
174+
}
175+
]
176+
},
177+
{
178+
"description": "disambiguatedPaths returns array indices as integers",
179+
"operations": [
180+
{
181+
"name": "insertOne",
182+
"object": "collection0",
183+
"arguments": {
184+
"document": {
185+
"_id": 1,
186+
"a": [
187+
{
188+
"1": 1
189+
}
190+
]
191+
}
192+
}
193+
},
194+
{
195+
"name": "createChangeStream",
196+
"object": "collection0",
197+
"arguments": {
198+
"pipeline": [],
199+
"showExpandedEvents": true
200+
},
201+
"saveResultAsEntity": "changeStream0"
202+
},
203+
{
204+
"name": "updateOne",
205+
"object": "collection0",
206+
"arguments": {
207+
"filter": {
208+
"_id": 1
209+
},
210+
"update": {
211+
"$set": {
212+
"a.0.1": 2
213+
}
214+
}
215+
}
216+
},
217+
{
218+
"name": "iterateUntilDocumentOrError",
219+
"object": "changeStream0",
220+
"expectResult": {
221+
"operationType": "update",
222+
"ns": {
223+
"db": "database0",
224+
"coll": "collection0"
225+
},
226+
"updateDescription": {
227+
"updatedFields": {
228+
"$$exists": true
229+
},
230+
"removedFields": {
231+
"$$exists": true
232+
},
233+
"truncatedArrays": {
234+
"$$exists": true
235+
},
236+
"disambiguatedPaths": {
237+
"a.0.1": [
238+
"a",
239+
{
240+
"$$type": "int"
241+
},
242+
"1"
243+
]
244+
}
245+
}
246+
}
247+
}
248+
]
249+
}
250+
]
251+
}

0 commit comments

Comments
 (0)