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