1{
2 "description": "bulkWrite-replaceOne-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 }
36 ]
37 }
38 ],
39 "tests": [
40 {
41 "description": "Replacing document with top-level dotted key on 3.6+ server",
42 "runOnRequirements": [
43 {
44 "minServerVersion": "3.6"
45 }
46 ],
47 "operations": [
48 {
49 "name": "bulkWrite",
50 "object": "collection0",
51 "arguments": {
52 "requests": [
53 {
54 "replaceOne": {
55 "filter": {
56 "_id": 1
57 },
58 "replacement": {
59 "_id": 1,
60 "a.b": 1
61 }
62 }
63 }
64 ]
65 },
66 "expectResult": {
67 "deletedCount": 0,
68 "insertedCount": 0,
69 "insertedIds": {
70 "$$unsetOrMatches": {}
71 },
72 "matchedCount": 1,
73 "modifiedCount": 1,
74 "upsertedCount": 0,
75 "upsertedIds": {}
76 }
77 }
78 ],
79 "expectEvents": [
80 {
81 "client": "client0",
82 "events": [
83 {
84 "commandStartedEvent": {
85 "command": {
86 "update": "coll0",
87 "updates": [
88 {
89 "q": {
90 "_id": 1
91 },
92 "u": {
93 "_id": 1,
94 "a.b": 1
95 },
96 "multi": {
97 "$$unsetOrMatches": false
98 },
99 "upsert": {
100 "$$unsetOrMatches": false
101 }
102 }
103 ]
104 }
105 }
106 }
107 ]
108 }
109 ],
110 "outcome": [
111 {
112 "collectionName": "coll0",
113 "databaseName": "crud-tests",
114 "documents": [
115 {
116 "_id": 1,
117 "a.b": 1
118 }
119 ]
120 }
121 ]
122 },
123 {
124 "description": "Replacing document with top-level dotted key on pre-3.6 server yields server-side error",
125 "runOnRequirements": [
126 {
127 "maxServerVersion": "3.4.99"
128 }
129 ],
130 "operations": [
131 {
132 "name": "bulkWrite",
133 "object": "collection0",
134 "arguments": {
135 "requests": [
136 {
137 "replaceOne": {
138 "filter": {
139 "_id": 1
140 },
141 "replacement": {
142 "_id": 1,
143 "a.b": 1
144 }
145 }
146 }
147 ]
148 },
149 "expectError": {
150 "isClientError": false
151 }
152 }
153 ],
154 "expectEvents": [
155 {
156 "client": "client0",
157 "events": [
158 {
159 "commandStartedEvent": {
160 "command": {
161 "update": "coll0",
162 "updates": [
163 {
164 "q": {
165 "_id": 1
166 },
167 "u": {
168 "_id": 1,
169 "a.b": 1
170 },
171 "multi": {
172 "$$unsetOrMatches": false
173 },
174 "upsert": {
175 "$$unsetOrMatches": false
176 }
177 }
178 ]
179 }
180 }
181 }
182 ]
183 }
184 ],
185 "outcome": [
186 {
187 "collectionName": "coll0",
188 "databaseName": "crud-tests",
189 "documents": [
190 {
191 "_id": 1
192 }
193 ]
194 }
195 ]
196 },
197 {
198 "description": "Replacing document with dollar-prefixed key in embedded doc on 5.0+ server",
199 "runOnRequirements": [
200 {
201 "minServerVersion": "5.0"
202 }
203 ],
204 "operations": [
205 {
206 "name": "bulkWrite",
207 "object": "collection0",
208 "arguments": {
209 "requests": [
210 {
211 "replaceOne": {
212 "filter": {
213 "_id": 1
214 },
215 "replacement": {
216 "_id": 1,
217 "a": {
218 "$b": 1
219 }
220 }
221 }
222 }
223 ]
224 },
225 "expectResult": {
226 "deletedCount": 0,
227 "insertedCount": 0,
228 "insertedIds": {
229 "$$unsetOrMatches": {}
230 },
231 "matchedCount": 1,
232 "modifiedCount": 1,
233 "upsertedCount": 0,
234 "upsertedIds": {}
235 }
236 }
237 ],
238 "expectEvents": [
239 {
240 "client": "client0",
241 "events": [
242 {
243 "commandStartedEvent": {
244 "command": {
245 "update": "coll0",
246 "updates": [
247 {
248 "q": {
249 "_id": 1
250 },
251 "u": {
252 "_id": 1,
253 "a": {
254 "$b": 1
255 }
256 },
257 "multi": {
258 "$$unsetOrMatches": false
259 },
260 "upsert": {
261 "$$unsetOrMatches": false
262 }
263 }
264 ]
265 }
266 }
267 }
268 ]
269 }
270 ],
271 "outcome": [
272 {
273 "collectionName": "coll0",
274 "databaseName": "crud-tests",
275 "documents": [
276 {
277 "_id": 1,
278 "a": {
279 "$b": 1
280 }
281 }
282 ]
283 }
284 ]
285 },
286 {
287 "description": "Replacing document with dollar-prefixed key in embedded doc on pre-5.0 server yields server-side error",
288 "runOnRequirements": [
289 {
290 "maxServerVersion": "4.99"
291 }
292 ],
293 "operations": [
294 {
295 "name": "bulkWrite",
296 "object": "collection0",
297 "arguments": {
298 "requests": [
299 {
300 "replaceOne": {
301 "filter": {
302 "_id": 1
303 },
304 "replacement": {
305 "_id": 1,
306 "a": {
307 "$b": 1
308 }
309 }
310 }
311 }
312 ]
313 },
314 "expectError": {
315 "isClientError": false
316 }
317 }
318 ],
319 "expectEvents": [
320 {
321 "client": "client0",
322 "events": [
323 {
324 "commandStartedEvent": {
325 "command": {
326 "update": "coll0",
327 "updates": [
328 {
329 "q": {
330 "_id": 1
331 },
332 "u": {
333 "_id": 1,
334 "a": {
335 "$b": 1
336 }
337 },
338 "multi": {
339 "$$unsetOrMatches": false
340 },
341 "upsert": {
342 "$$unsetOrMatches": false
343 }
344 }
345 ]
346 }
347 }
348 }
349 ]
350 }
351 ],
352 "outcome": [
353 {
354 "collectionName": "coll0",
355 "databaseName": "crud-tests",
356 "documents": [
357 {
358 "_id": 1
359 }
360 ]
361 }
362 ]
363 },
364 {
365 "description": "Replacing document with dotted key in embedded doc on 3.6+ server",
366 "runOnRequirements": [
367 {
368 "minServerVersion": "3.6"
369 }
370 ],
371 "operations": [
372 {
373 "name": "bulkWrite",
374 "object": "collection0",
375 "arguments": {
376 "requests": [
377 {
378 "replaceOne": {
379 "filter": {
380 "_id": 1
381 },
382 "replacement": {
383 "_id": 1,
384 "a": {
385 "b.c": 1
386 }
387 }
388 }
389 }
390 ]
391 },
392 "expectResult": {
393 "deletedCount": 0,
394 "insertedCount": 0,
395 "insertedIds": {
396 "$$unsetOrMatches": {}
397 },
398 "matchedCount": 1,
399 "modifiedCount": 1,
400 "upsertedCount": 0,
401 "upsertedIds": {}
402 }
403 }
404 ],
405 "expectEvents": [
406 {
407 "client": "client0",
408 "events": [
409 {
410 "commandStartedEvent": {
411 "command": {
412 "update": "coll0",
413 "updates": [
414 {
415 "q": {
416 "_id": 1
417 },
418 "u": {
419 "_id": 1,
420 "a": {
421 "b.c": 1
422 }
423 },
424 "multi": {
425 "$$unsetOrMatches": false
426 },
427 "upsert": {
428 "$$unsetOrMatches": false
429 }
430 }
431 ]
432 }
433 }
434 }
435 ]
436 }
437 ],
438 "outcome": [
439 {
440 "collectionName": "coll0",
441 "databaseName": "crud-tests",
442 "documents": [
443 {
444 "_id": 1,
445 "a": {
446 "b.c": 1
447 }
448 }
449 ]
450 }
451 ]
452 },
453 {
454 "description": "Replacing document with dotted key in embedded doc on pre-3.6 server yields server-side error",
455 "runOnRequirements": [
456 {
457 "maxServerVersion": "3.4.99"
458 }
459 ],
460 "operations": [
461 {
462 "name": "bulkWrite",
463 "object": "collection0",
464 "arguments": {
465 "requests": [
466 {
467 "replaceOne": {
468 "filter": {
469 "_id": 1
470 },
471 "replacement": {
472 "_id": 1,
473 "a": {
474 "b.c": 1
475 }
476 }
477 }
478 }
479 ]
480 },
481 "expectError": {
482 "isClientError": false
483 }
484 }
485 ],
486 "expectEvents": [
487 {
488 "client": "client0",
489 "events": [
490 {
491 "commandStartedEvent": {
492 "command": {
493 "update": "coll0",
494 "updates": [
495 {
496 "q": {
497 "_id": 1
498 },
499 "u": {
500 "_id": 1,
501 "a": {
502 "b.c": 1
503 }
504 },
505 "multi": {
506 "$$unsetOrMatches": false
507 },
508 "upsert": {
509 "$$unsetOrMatches": false
510 }
511 }
512 ]
513 }
514 }
515 }
516 ]
517 }
518 ],
519 "outcome": [
520 {
521 "collectionName": "coll0",
522 "databaseName": "crud-tests",
523 "documents": [
524 {
525 "_id": 1
526 }
527 ]
528 }
529 ]
530 }
531 ]
532}
View as plain text