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