1{
2 "description": "runCommand",
3 "schemaVersion": "1.3",
4 "createEntities": [
5 {
6 "client": {
7 "id": "client",
8 "useMultipleMongoses": false,
9 "observeEvents": [
10 "commandStartedEvent"
11 ]
12 }
13 },
14 {
15 "database": {
16 "id": "db",
17 "client": "client",
18 "databaseName": "db"
19 }
20 },
21 {
22 "collection": {
23 "id": "collection",
24 "database": "db",
25 "collectionName": "collection"
26 }
27 },
28 {
29 "database": {
30 "id": "dbWithRC",
31 "client": "client",
32 "databaseName": "dbWithRC",
33 "databaseOptions": {
34 "readConcern": {
35 "level": "local"
36 }
37 }
38 }
39 },
40 {
41 "database": {
42 "id": "dbWithWC",
43 "client": "client",
44 "databaseName": "dbWithWC",
45 "databaseOptions": {
46 "writeConcern": {
47 "w": 0
48 }
49 }
50 }
51 },
52 {
53 "session": {
54 "id": "session",
55 "client": "client"
56 }
57 },
58 {
59 "client": {
60 "id": "clientWithStableApi",
61 "observeEvents": [
62 "commandStartedEvent"
63 ],
64 "serverApi": {
65 "version": "1",
66 "strict": true
67 }
68 }
69 },
70 {
71 "database": {
72 "id": "dbWithStableApi",
73 "client": "clientWithStableApi",
74 "databaseName": "dbWithStableApi"
75 }
76 }
77 ],
78 "initialData": [
79 {
80 "collectionName": "collection",
81 "databaseName": "db",
82 "documents": []
83 }
84 ],
85 "tests": [
86 {
87 "description": "always attaches $db and implicit lsid to given command and omits default readPreference",
88 "operations": [
89 {
90 "name": "runCommand",
91 "object": "db",
92 "arguments": {
93 "commandName": "ping",
94 "command": {
95 "ping": 1
96 }
97 },
98 "expectResult": {
99 "ok": 1
100 }
101 }
102 ],
103 "expectEvents": [
104 {
105 "client": "client",
106 "events": [
107 {
108 "commandStartedEvent": {
109 "command": {
110 "ping": 1,
111 "$db": "db",
112 "lsid": {
113 "$$exists": true
114 },
115 "$readPreference": {
116 "$$exists": false
117 }
118 },
119 "commandName": "ping"
120 }
121 }
122 ]
123 }
124 ]
125 },
126 {
127 "description": "always gossips the $clusterTime on the sent command",
128 "runOnRequirements": [
129 {
130 "topologies": [
131 "replicaset",
132 "sharded"
133 ]
134 }
135 ],
136 "operations": [
137 {
138 "name": "runCommand",
139 "object": "db",
140 "arguments": {
141 "commandName": "ping",
142 "command": {
143 "ping": 1
144 }
145 },
146 "expectResult": {
147 "ok": 1
148 }
149 },
150 {
151 "name": "runCommand",
152 "object": "db",
153 "arguments": {
154 "commandName": "ping",
155 "command": {
156 "ping": 1
157 }
158 },
159 "expectResult": {
160 "ok": 1
161 }
162 }
163 ],
164 "expectEvents": [
165 {
166 "client": "client",
167 "events": [
168 {
169 "commandStartedEvent": {
170 "commandName": "ping"
171 }
172 },
173 {
174 "commandStartedEvent": {
175 "command": {
176 "ping": 1,
177 "$clusterTime": {
178 "$$exists": true
179 }
180 },
181 "commandName": "ping"
182 }
183 }
184 ]
185 }
186 ]
187 },
188 {
189 "description": "attaches the provided session lsid to given command",
190 "operations": [
191 {
192 "name": "runCommand",
193 "object": "db",
194 "arguments": {
195 "commandName": "ping",
196 "command": {
197 "ping": 1
198 },
199 "session": "session"
200 },
201 "expectResult": {
202 "ok": 1
203 }
204 }
205 ],
206 "expectEvents": [
207 {
208 "client": "client",
209 "events": [
210 {
211 "commandStartedEvent": {
212 "command": {
213 "ping": 1,
214 "lsid": {
215 "$$sessionLsid": "session"
216 },
217 "$db": "db"
218 },
219 "commandName": "ping"
220 }
221 }
222 ]
223 }
224 ]
225 },
226 {
227 "description": "attaches the provided $readPreference to given command",
228 "runOnRequirements": [
229 {
230 "topologies": [
231 "replicaset",
232 "sharded-replicaset",
233 "load-balanced",
234 "sharded"
235 ]
236 }
237 ],
238 "operations": [
239 {
240 "name": "runCommand",
241 "object": "db",
242 "arguments": {
243 "commandName": "ping",
244 "command": {
245 "ping": 1
246 },
247 "readPreference": {
248 "mode": "nearest"
249 }
250 },
251 "expectResult": {
252 "ok": 1
253 }
254 }
255 ],
256 "expectEvents": [
257 {
258 "client": "client",
259 "events": [
260 {
261 "commandStartedEvent": {
262 "command": {
263 "ping": 1,
264 "$readPreference": {
265 "mode": "nearest"
266 },
267 "$db": "db"
268 },
269 "commandName": "ping"
270 }
271 }
272 ]
273 }
274 ]
275 },
276 {
277 "description": "does not attach $readPreference to given command on standalone",
278 "runOnRequirements": [
279 {
280 "topologies": [
281 "single"
282 ]
283 }
284 ],
285 "operations": [
286 {
287 "name": "runCommand",
288 "object": "db",
289 "arguments": {
290 "commandName": "ping",
291 "command": {
292 "ping": 1
293 },
294 "readPreference": {
295 "mode": "nearest"
296 }
297 },
298 "expectResult": {
299 "ok": 1
300 }
301 }
302 ],
303 "expectEvents": [
304 {
305 "client": "client",
306 "events": [
307 {
308 "commandStartedEvent": {
309 "command": {
310 "ping": 1,
311 "$readPreference": {
312 "$$exists": false
313 },
314 "$db": "db"
315 },
316 "commandName": "ping"
317 }
318 }
319 ]
320 }
321 ]
322 },
323 {
324 "description": "does not attach primary $readPreference to given command",
325 "operations": [
326 {
327 "name": "runCommand",
328 "object": "db",
329 "arguments": {
330 "commandName": "ping",
331 "command": {
332 "ping": 1
333 },
334 "readPreference": {
335 "mode": "primary"
336 }
337 },
338 "expectResult": {
339 "ok": 1
340 }
341 }
342 ],
343 "expectEvents": [
344 {
345 "client": "client",
346 "events": [
347 {
348 "commandStartedEvent": {
349 "command": {
350 "ping": 1,
351 "$readPreference": {
352 "$$exists": false
353 },
354 "$db": "db"
355 },
356 "commandName": "ping"
357 }
358 }
359 ]
360 }
361 ]
362 },
363 {
364 "description": "does not inherit readConcern specified at the db level",
365 "operations": [
366 {
367 "name": "runCommand",
368 "object": "dbWithRC",
369 "arguments": {
370 "commandName": "aggregate",
371 "command": {
372 "aggregate": "collection",
373 "pipeline": [],
374 "cursor": {}
375 }
376 }
377 }
378 ],
379 "expectEvents": [
380 {
381 "client": "client",
382 "events": [
383 {
384 "commandStartedEvent": {
385 "command": {
386 "aggregate": "collection",
387 "readConcern": {
388 "$$exists": false
389 },
390 "$db": "dbWithRC"
391 },
392 "commandName": "aggregate"
393 }
394 }
395 ]
396 }
397 ]
398 },
399 {
400 "description": "does not inherit writeConcern specified at the db level",
401 "operations": [
402 {
403 "name": "runCommand",
404 "object": "dbWithWC",
405 "arguments": {
406 "commandName": "insert",
407 "command": {
408 "insert": "collection",
409 "documents": [
410 {
411 "foo": "bar"
412 }
413 ],
414 "ordered": true
415 }
416 },
417 "expectResult": {
418 "ok": 1
419 }
420 }
421 ],
422 "expectEvents": [
423 {
424 "client": "client",
425 "events": [
426 {
427 "commandStartedEvent": {
428 "command": {
429 "insert": "collection",
430 "writeConcern": {
431 "$$exists": false
432 },
433 "$db": "dbWithWC"
434 },
435 "commandName": "insert"
436 }
437 }
438 ]
439 }
440 ]
441 },
442 {
443 "description": "does not retry retryable errors on given command",
444 "runOnRequirements": [
445 {
446 "minServerVersion": "4.2"
447 }
448 ],
449 "operations": [
450 {
451 "name": "failPoint",
452 "object": "testRunner",
453 "arguments": {
454 "client": "client",
455 "failPoint": {
456 "configureFailPoint": "failCommand",
457 "mode": {
458 "times": 1
459 },
460 "data": {
461 "failCommands": [
462 "ping"
463 ],
464 "closeConnection": true
465 }
466 }
467 }
468 },
469 {
470 "name": "runCommand",
471 "object": "db",
472 "arguments": {
473 "commandName": "ping",
474 "command": {
475 "ping": 1
476 }
477 },
478 "expectError": {
479 "isClientError": true
480 }
481 }
482 ]
483 },
484 {
485 "description": "attaches transaction fields to given command",
486 "runOnRequirements": [
487 {
488 "minServerVersion": "4.0",
489 "topologies": [
490 "replicaset"
491 ]
492 },
493 {
494 "minServerVersion": "4.2",
495 "topologies": [
496 "sharded-replicaset",
497 "load-balanced"
498 ]
499 }
500 ],
501 "operations": [
502 {
503 "name": "withTransaction",
504 "object": "session",
505 "arguments": {
506 "callback": [
507 {
508 "name": "runCommand",
509 "object": "db",
510 "arguments": {
511 "session": "session",
512 "commandName": "insert",
513 "command": {
514 "insert": "collection",
515 "documents": [
516 {
517 "foo": "transaction"
518 }
519 ],
520 "ordered": true
521 }
522 },
523 "expectResult": {
524 "$$unsetOrMatches": {
525 "insertedId": {
526 "$$unsetOrMatches": 1
527 }
528 }
529 }
530 }
531 ]
532 }
533 }
534 ],
535 "expectEvents": [
536 {
537 "client": "client",
538 "events": [
539 {
540 "commandStartedEvent": {
541 "command": {
542 "insert": "collection",
543 "documents": [
544 {
545 "foo": "transaction"
546 }
547 ],
548 "ordered": true,
549 "lsid": {
550 "$$sessionLsid": "session"
551 },
552 "txnNumber": 1,
553 "startTransaction": true,
554 "autocommit": false,
555 "readConcern": {
556 "$$exists": false
557 },
558 "writeConcern": {
559 "$$exists": false
560 }
561 },
562 "commandName": "insert",
563 "databaseName": "db"
564 }
565 },
566 {
567 "commandStartedEvent": {
568 "command": {
569 "commitTransaction": 1,
570 "lsid": {
571 "$$sessionLsid": "session"
572 },
573 "txnNumber": 1,
574 "autocommit": false,
575 "writeConcern": {
576 "$$exists": false
577 },
578 "readConcern": {
579 "$$exists": false
580 }
581 },
582 "commandName": "commitTransaction",
583 "databaseName": "admin"
584 }
585 }
586 ]
587 }
588 ]
589 },
590 {
591 "description": "attaches apiVersion fields to given command when stableApi is configured on the client",
592 "runOnRequirements": [
593 {
594 "minServerVersion": "5.0"
595 }
596 ],
597 "operations": [
598 {
599 "name": "runCommand",
600 "object": "dbWithStableApi",
601 "arguments": {
602 "commandName": "ping",
603 "command": {
604 "ping": 1
605 }
606 },
607 "expectResult": {
608 "ok": 1
609 }
610 }
611 ],
612 "expectEvents": [
613 {
614 "client": "clientWithStableApi",
615 "events": [
616 {
617 "commandStartedEvent": {
618 "command": {
619 "ping": 1,
620 "$db": "dbWithStableApi",
621 "apiVersion": "1",
622 "apiStrict": true,
623 "apiDeprecationErrors": {
624 "$$unsetOrMatches": false
625 }
626 },
627 "commandName": "ping"
628 }
629 }
630 ]
631 }
632 ]
633 }
634 ]
635}
View as plain text