1{
2 "description": "bulkWrite-updateMany-dots_and_dollars",
3 "schemaVersion": "1.0",
4 "createEntities": [
5 {
6 "client": {
7 "id": "client0",
8 "observeEvents": [
9 "commandStartedEvent"
10 ]
11 }
12 },
13 {
14 "database": {
15 "id": "database0",
16 "client": "client0",
17 "databaseName": "crud-tests"
18 }
19 },
20 {
21 "collection": {
22 "id": "collection0",
23 "database": "database0",
24 "collectionName": "coll0"
25 }
26 }
27 ],
28 "initialData": [
29 {
30 "collectionName": "coll0",
31 "databaseName": "crud-tests",
32 "documents": [
33 {
34 "_id": 1,
35 "foo": {}
36 }
37 ]
38 }
39 ],
40 "tests": [
41 {
42 "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server",
43 "runOnRequirements": [
44 {
45 "minServerVersion": "5.0"
46 }
47 ],
48 "operations": [
49 {
50 "name": "bulkWrite",
51 "object": "collection0",
52 "arguments": {
53 "requests": [
54 {
55 "updateMany": {
56 "filter": {
57 "_id": 1
58 },
59 "update": [
60 {
61 "$replaceWith": {
62 "$setField": {
63 "field": {
64 "$literal": "$a"
65 },
66 "value": 1,
67 "input": "$$ROOT"
68 }
69 }
70 }
71 ]
72 }
73 }
74 ]
75 },
76 "expectResult": {
77 "deletedCount": 0,
78 "insertedCount": 0,
79 "insertedIds": {
80 "$$unsetOrMatches": {}
81 },
82 "matchedCount": 1,
83 "modifiedCount": 1,
84 "upsertedCount": 0,
85 "upsertedIds": {}
86 }
87 }
88 ],
89 "expectEvents": [
90 {
91 "client": "client0",
92 "events": [
93 {
94 "commandStartedEvent": {
95 "command": {
96 "update": "coll0",
97 "updates": [
98 {
99 "q": {
100 "_id": 1
101 },
102 "u": [
103 {
104 "$replaceWith": {
105 "$setField": {
106 "field": {
107 "$literal": "$a"
108 },
109 "value": 1,
110 "input": "$$ROOT"
111 }
112 }
113 }
114 ],
115 "multi": true,
116 "upsert": {
117 "$$unsetOrMatches": false
118 }
119 }
120 ]
121 }
122 }
123 }
124 ]
125 }
126 ],
127 "outcome": [
128 {
129 "collectionName": "coll0",
130 "databaseName": "crud-tests",
131 "documents": [
132 {
133 "_id": 1,
134 "foo": {},
135 "$a": 1
136 }
137 ]
138 }
139 ]
140 },
141 {
142 "description": "Updating document to set top-level dotted key on 5.0+ server",
143 "runOnRequirements": [
144 {
145 "minServerVersion": "5.0"
146 }
147 ],
148 "operations": [
149 {
150 "name": "bulkWrite",
151 "object": "collection0",
152 "arguments": {
153 "requests": [
154 {
155 "updateMany": {
156 "filter": {
157 "_id": 1
158 },
159 "update": [
160 {
161 "$replaceWith": {
162 "$setField": {
163 "field": {
164 "$literal": "a.b"
165 },
166 "value": 1,
167 "input": "$$ROOT"
168 }
169 }
170 }
171 ]
172 }
173 }
174 ]
175 },
176 "expectResult": {
177 "deletedCount": 0,
178 "insertedCount": 0,
179 "insertedIds": {
180 "$$unsetOrMatches": {}
181 },
182 "matchedCount": 1,
183 "modifiedCount": 1,
184 "upsertedCount": 0,
185 "upsertedIds": {}
186 }
187 }
188 ],
189 "expectEvents": [
190 {
191 "client": "client0",
192 "events": [
193 {
194 "commandStartedEvent": {
195 "command": {
196 "update": "coll0",
197 "updates": [
198 {
199 "q": {
200 "_id": 1
201 },
202 "u": [
203 {
204 "$replaceWith": {
205 "$setField": {
206 "field": {
207 "$literal": "a.b"
208 },
209 "value": 1,
210 "input": "$$ROOT"
211 }
212 }
213 }
214 ],
215 "multi": true,
216 "upsert": {
217 "$$unsetOrMatches": false
218 }
219 }
220 ]
221 }
222 }
223 }
224 ]
225 }
226 ],
227 "outcome": [
228 {
229 "collectionName": "coll0",
230 "databaseName": "crud-tests",
231 "documents": [
232 {
233 "_id": 1,
234 "foo": {},
235 "a.b": 1
236 }
237 ]
238 }
239 ]
240 },
241 {
242 "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server",
243 "runOnRequirements": [
244 {
245 "minServerVersion": "5.0"
246 }
247 ],
248 "operations": [
249 {
250 "name": "bulkWrite",
251 "object": "collection0",
252 "arguments": {
253 "requests": [
254 {
255 "updateMany": {
256 "filter": {
257 "_id": 1
258 },
259 "update": [
260 {
261 "$set": {
262 "foo": {
263 "$setField": {
264 "field": {
265 "$literal": "$a"
266 },
267 "value": 1,
268 "input": "$foo"
269 }
270 }
271 }
272 }
273 ]
274 }
275 }
276 ]
277 },
278 "expectResult": {
279 "deletedCount": 0,
280 "insertedCount": 0,
281 "insertedIds": {
282 "$$unsetOrMatches": {}
283 },
284 "matchedCount": 1,
285 "modifiedCount": 1,
286 "upsertedCount": 0,
287 "upsertedIds": {}
288 }
289 }
290 ],
291 "expectEvents": [
292 {
293 "client": "client0",
294 "events": [
295 {
296 "commandStartedEvent": {
297 "command": {
298 "update": "coll0",
299 "updates": [
300 {
301 "q": {
302 "_id": 1
303 },
304 "u": [
305 {
306 "$set": {
307 "foo": {
308 "$setField": {
309 "field": {
310 "$literal": "$a"
311 },
312 "value": 1,
313 "input": "$foo"
314 }
315 }
316 }
317 }
318 ],
319 "multi": true,
320 "upsert": {
321 "$$unsetOrMatches": false
322 }
323 }
324 ]
325 }
326 }
327 }
328 ]
329 }
330 ],
331 "outcome": [
332 {
333 "collectionName": "coll0",
334 "databaseName": "crud-tests",
335 "documents": [
336 {
337 "_id": 1,
338 "foo": {
339 "$a": 1
340 }
341 }
342 ]
343 }
344 ]
345 },
346 {
347 "description": "Updating document to set dotted key in embedded doc on 5.0+ server",
348 "runOnRequirements": [
349 {
350 "minServerVersion": "5.0"
351 }
352 ],
353 "operations": [
354 {
355 "name": "bulkWrite",
356 "object": "collection0",
357 "arguments": {
358 "requests": [
359 {
360 "updateMany": {
361 "filter": {
362 "_id": 1
363 },
364 "update": [
365 {
366 "$set": {
367 "foo": {
368 "$setField": {
369 "field": {
370 "$literal": "a.b"
371 },
372 "value": 1,
373 "input": "$foo"
374 }
375 }
376 }
377 }
378 ]
379 }
380 }
381 ]
382 },
383 "expectResult": {
384 "deletedCount": 0,
385 "insertedCount": 0,
386 "insertedIds": {
387 "$$unsetOrMatches": {}
388 },
389 "matchedCount": 1,
390 "modifiedCount": 1,
391 "upsertedCount": 0,
392 "upsertedIds": {}
393 }
394 }
395 ],
396 "expectEvents": [
397 {
398 "client": "client0",
399 "events": [
400 {
401 "commandStartedEvent": {
402 "command": {
403 "update": "coll0",
404 "updates": [
405 {
406 "q": {
407 "_id": 1
408 },
409 "u": [
410 {
411 "$set": {
412 "foo": {
413 "$setField": {
414 "field": {
415 "$literal": "a.b"
416 },
417 "value": 1,
418 "input": "$foo"
419 }
420 }
421 }
422 }
423 ],
424 "multi": true,
425 "upsert": {
426 "$$unsetOrMatches": false
427 }
428 }
429 ]
430 }
431 }
432 }
433 ]
434 }
435 ],
436 "outcome": [
437 {
438 "collectionName": "coll0",
439 "databaseName": "crud-tests",
440 "documents": [
441 {
442 "_id": 1,
443 "foo": {
444 "a.b": 1
445 }
446 }
447 ]
448 }
449 ]
450 }
451 ]
452}
View as plain text