Debian Codegraph @

testdata/transactions/legacy/transaction-options.json

raw symbols SCIP
1 {
2 "runOn": [
3 {
4 "minServerVersion": "4.0",
5 "topology": [
6 "replicaset"
7 ]
8 },
9 {
10 "minServerVersion": "4.1.8",
11 "topology": [
12 "sharded"
13 ]
14 }
15 ],
16 "database_name": "transaction-tests",
17 "collection_name": "test",
18 "data": [],
19 "tests": [
20 {
21 "description": "no transaction options set",
22 "operations": [
23 {
24 "name": "startTransaction",
25 "object": "session0"
26 },
27 {
28 "name": "insertOne",
29 "object": "collection",
30 "arguments": {
31 "session": "session0",
32 "document": {
33 "_id": 1
34 }
35 },
36 "result": {
37 "insertedId": 1
38 }
39 },
40 {
41 "name": "commitTransaction",
42 "object": "session0"
43 },
44 {
45 "name": "startTransaction",
46 "object": "session0"
47 },
48 {
49 "name": "insertOne",
50 "object": "collection",
51 "arguments": {
52 "session": "session0",
53 "document": {
54 "_id": 2
55 }
56 },
57 "result": {
58 "insertedId": 2
59 }
60 },
61 {
62 "name": "abortTransaction",
63 "object": "session0"
64 }
65 ],
66 "expectations": [
67 {
68 "command_started_event": {
69 "command": {
70 "insert": "test",
71 "documents": [
72 {
73 "_id": 1
74 }
75 ],
76 "ordered": true,
77 "lsid": "session0",
78 "txnNumber": {
79 "$numberLong": "1"
80 },
81 "startTransaction": true,
82 "autocommit": false,
83 "readConcern": null,
84 "writeConcern": null,
85 "maxTimeMS": null
86 },
87 "command_name": "insert",
88 "database_name": "transaction-tests"
89 }
90 },
91 {
92 "command_started_event": {
93 "command": {
94 "commitTransaction": 1,
95 "lsid": "session0",
96 "txnNumber": {
97 "$numberLong": "1"
98 },
99 "startTransaction": null,
100 "autocommit": false,
101 "readConcern": null,
102 "writeConcern": null,
103 "maxTimeMS": null
104 },
105 "command_name": "commitTransaction",
106 "database_name": "admin"
107 }
108 },
109 {
110 "command_started_event": {
111 "command": {
112 "insert": "test",
113 "documents": [
114 {
115 "_id": 2
116 }
117 ],
118 "ordered": true,
119 "lsid": "session0",
120 "txnNumber": {
121 "$numberLong": "2"
122 },
123 "startTransaction": true,
124 "autocommit": false,
125 "readConcern": {
126 "afterClusterTime": 42
127 },
128 "writeConcern": null,
129 "maxTimeMS": null
130 },
131 "command_name": "insert",
132 "database_name": "transaction-tests"
133 }
134 },
135 {
136 "command_started_event": {
137 "command": {
138 "abortTransaction": 1,
139 "lsid": "session0",
140 "txnNumber": {
141 "$numberLong": "2"
142 },
143 "startTransaction": null,
144 "autocommit": false,
145 "readConcern": null,
146 "writeConcern": null,
147 "maxTimeMS": null
148 },
149 "command_name": "abortTransaction",
150 "database_name": "admin"
151 }
152 }
153 ],
154 "outcome": {
155 "collection": {
156 "data": [
157 {
158 "_id": 1
159 }
160 ]
161 }
162 }
163 },
164 {
165 "description": "transaction options inherited from client",
166 "clientOptions": {
167 "w": 1,
168 "readConcernLevel": "local"
169 },
170 "operations": [
171 {
172 "name": "startTransaction",
173 "object": "session0"
174 },
175 {
176 "name": "insertOne",
177 "object": "collection",
178 "arguments": {
179 "session": "session0",
180 "document": {
181 "_id": 1
182 }
183 },
184 "result": {
185 "insertedId": 1
186 }
187 },
188 {
189 "name": "commitTransaction",
190 "object": "session0"
191 },
192 {
193 "name": "startTransaction",
194 "object": "session0"
195 },
196 {
197 "name": "insertOne",
198 "object": "collection",
199 "arguments": {
200 "session": "session0",
201 "document": {
202 "_id": 2
203 }
204 },
205 "result": {
206 "insertedId": 2
207 }
208 },
209 {
210 "name": "abortTransaction",
211 "object": "session0"
212 }
213 ],
214 "expectations": [
215 {
216 "command_started_event": {
217 "command": {
218 "insert": "test",
219 "documents": [
220 {
221 "_id": 1
222 }
223 ],
224 "ordered": true,
225 "lsid": "session0",
226 "txnNumber": {
227 "$numberLong": "1"
228 },
229 "startTransaction": true,
230 "autocommit": false,
231 "readConcern": {
232 "level": "local"
233 },
234 "writeConcern": null,
235 "maxTimeMS": null
236 },
237 "command_name": "insert",
238 "database_name": "transaction-tests"
239 }
240 },
241 {
242 "command_started_event": {
243 "command": {
244 "commitTransaction": 1,
245 "lsid": "session0",
246 "txnNumber": {
247 "$numberLong": "1"
248 },
249 "startTransaction": null,
250 "autocommit": false,
251 "readConcern": null,
252 "writeConcern": {
253 "w": 1
254 },
255 "maxTimeMS": null
256 },
257 "command_name": "commitTransaction",
258 "database_name": "admin"
259 }
260 },
261 {
262 "command_started_event": {
263 "command": {
264 "insert": "test",
265 "documents": [
266 {
267 "_id": 2
268 }
269 ],
270 "ordered": true,
271 "lsid": "session0",
272 "txnNumber": {
273 "$numberLong": "2"
274 },
275 "startTransaction": true,
276 "autocommit": false,
277 "readConcern": {
278 "level": "local",
279 "afterClusterTime": 42
280 },
281 "writeConcern": null,
282 "maxTimeMS": null
283 },
284 "command_name": "insert",
285 "database_name": "transaction-tests"
286 }
287 },
288 {
289 "command_started_event": {
290 "command": {
291 "abortTransaction": 1,
292 "lsid": "session0",
293 "txnNumber": {
294 "$numberLong": "2"
295 },
296 "startTransaction": null,
297 "autocommit": false,
298 "readConcern": null,
299 "writeConcern": {
300 "w": 1
301 },
302 "maxTimeMS": null
303 },
304 "command_name": "abortTransaction",
305 "database_name": "admin"
306 }
307 }
308 ],
309 "outcome": {
310 "collection": {
311 "data": [
312 {
313 "_id": 1
314 }
315 ]
316 }
317 }
318 },
319 {
320 "description": "transaction options inherited from defaultTransactionOptions",
321 "sessionOptions": {
322 "session0": {
323 "defaultTransactionOptions": {
324 "readConcern": {
325 "level": "majority"
326 },
327 "writeConcern": {
328 "w": 1
329 },
330 "maxCommitTimeMS": 60000
331 }
332 }
333 },
334 "operations": [
335 {
336 "name": "startTransaction",
337 "object": "session0"
338 },
339 {
340 "name": "insertOne",
341 "object": "collection",
342 "arguments": {
343 "session": "session0",
344 "document": {
345 "_id": 1
346 }
347 },
348 "result": {
349 "insertedId": 1
350 }
351 },
352 {
353 "name": "commitTransaction",
354 "object": "session0"
355 },
356 {
357 "name": "startTransaction",
358 "object": "session0"
359 },
360 {
361 "name": "insertOne",
362 "object": "collection",
363 "arguments": {
364 "session": "session0",
365 "document": {
366 "_id": 2
367 }
368 },
369 "result": {
370 "insertedId": 2
371 }
372 },
373 {
374 "name": "abortTransaction",
375 "object": "session0"
376 }
377 ],
378 "expectations": [
379 {
380 "command_started_event": {
381 "command": {
382 "insert": "test",
383 "documents": [
384 {
385 "_id": 1
386 }
387 ],
388 "ordered": true,
389 "lsid": "session0",
390 "txnNumber": {
391 "$numberLong": "1"
392 },
393 "startTransaction": true,
394 "autocommit": false,
395 "readConcern": {
396 "level": "majority"
397 },
398 "writeConcern": null
399 },
400 "command_name": "insert",
401 "database_name": "transaction-tests"
402 }
403 },
404 {
405 "command_started_event": {
406 "command": {
407 "commitTransaction": 1,
408 "lsid": "session0",
409 "txnNumber": {
410 "$numberLong": "1"
411 },
412 "startTransaction": null,
413 "autocommit": false,
414 "readConcern": null,
415 "writeConcern": {
416 "w": 1
417 },
418 "maxTimeMS": 60000
419 },
420 "command_name": "commitTransaction",
421 "database_name": "admin"
422 }
423 },
424 {
425 "command_started_event": {
426 "command": {
427 "insert": "test",
428 "documents": [
429 {
430 "_id": 2
431 }
432 ],
433 "ordered": true,
434 "lsid": "session0",
435 "txnNumber": {
436 "$numberLong": "2"
437 },
438 "startTransaction": true,
439 "autocommit": false,
440 "readConcern": {
441 "level": "majority",
442 "afterClusterTime": 42
443 },
444 "writeConcern": null
445 },
446 "command_name": "insert",
447 "database_name": "transaction-tests"
448 }
449 },
450 {
451 "command_started_event": {
452 "command": {
453 "abortTransaction": 1,
454 "lsid": "session0",
455 "txnNumber": {
456 "$numberLong": "2"
457 },
458 "startTransaction": null,
459 "autocommit": false,
460 "readConcern": null,
461 "writeConcern": {
462 "w": 1
463 }
464 },
465 "command_name": "abortTransaction",
466 "database_name": "admin"
467 }
468 }
469 ],
470 "outcome": {
471 "collection": {
472 "data": [
473 {
474 "_id": 1
475 }
476 ]
477 }
478 }
479 },
480 {
481 "description": "startTransaction options override defaults",
482 "clientOptions": {
483 "readConcernLevel": "local",
484 "w": 1
485 },
486 "sessionOptions": {
487 "session0": {
488 "defaultTransactionOptions": {
489 "readConcern": {
490 "level": "snapshot"
491 },
492 "writeConcern": {
493 "w": 1
494 },
495 "maxCommitTimeMS": 30000
496 }
497 }
498 },
499 "operations": [
500 {
501 "name": "startTransaction",
502 "object": "session0",
503 "arguments": {
504 "options": {
505 "readConcern": {
506 "level": "majority"
507 },
508 "writeConcern": {
509 "w": "majority"
510 },
511 "maxCommitTimeMS": 60000
512 }
513 }
514 },
515 {
516 "name": "insertOne",
517 "object": "collection",
518 "arguments": {
519 "session": "session0",
520 "document": {
521 "_id": 1
522 }
523 },
524 "result": {
525 "insertedId": 1
526 }
527 },
528 {
529 "name": "commitTransaction",
530 "object": "session0"
531 },
532 {
533 "name": "startTransaction",
534 "object": "session0",
535 "arguments": {
536 "options": {
537 "readConcern": {
538 "level": "majority"
539 },
540 "writeConcern": {
541 "w": "majority"
542 }
543 }
544 }
545 },
546 {
547 "name": "insertOne",
548 "object": "collection",
549 "arguments": {
550 "session": "session0",
551 "document": {
552 "_id": 2
553 }
554 },
555 "result": {
556 "insertedId": 2
557 }
558 },
559 {
560 "name": "abortTransaction",
561 "object": "session0"
562 }
563 ],
564 "expectations": [
565 {
566 "command_started_event": {
567 "command": {
568 "insert": "test",
569 "documents": [
570 {
571 "_id": 1
572 }
573 ],
574 "ordered": true,
575 "lsid": "session0",
576 "txnNumber": {
577 "$numberLong": "1"
578 },
579 "startTransaction": true,
580 "autocommit": false,
581 "readConcern": {
582 "level": "majority"
583 },
584 "writeConcern": null,
585 "maxTimeMS": null
586 },
587 "command_name": "insert",
588 "database_name": "transaction-tests"
589 }
590 },
591 {
592 "command_started_event": {
593 "command": {
594 "commitTransaction": 1,
595 "lsid": "session0",
596 "txnNumber": {
597 "$numberLong": "1"
598 },
599 "startTransaction": null,
600 "autocommit": false,
601 "readConcern": null,
602 "writeConcern": {
603 "w": "majority"
604 },
605 "maxTimeMS": 60000
606 },
607 "command_name": "commitTransaction",
608 "database_name": "admin"
609 }
610 },
611 {
612 "command_started_event": {
613 "command": {
614 "insert": "test",
615 "documents": [
616 {
617 "_id": 2
618 }
619 ],
620 "ordered": true,
621 "lsid": "session0",
622 "txnNumber": {
623 "$numberLong": "2"
624 },
625 "startTransaction": true,
626 "autocommit": false,
627 "readConcern": {
628 "level": "majority",
629 "afterClusterTime": 42
630 },
631 "writeConcern": null,
632 "maxTimeMS": null
633 },
634 "command_name": "insert",
635 "database_name": "transaction-tests"
636 }
637 },
638 {
639 "command_started_event": {
640 "command": {
641 "abortTransaction": 1,
642 "lsid": "session0",
643 "txnNumber": {
644 "$numberLong": "2"
645 },
646 "startTransaction": null,
647 "autocommit": false,
648 "readConcern": null,
649 "writeConcern": {
650 "w": "majority"
651 },
652 "maxTimeMS": null
653 },
654 "command_name": "abortTransaction",
655 "database_name": "admin"
656 }
657 }
658 ],
659 "outcome": {
660 "collection": {
661 "data": [
662 {
663 "_id": 1
664 }
665 ]
666 }
667 }
668 },
669 {
670 "description": "defaultTransactionOptions override client options",
671 "clientOptions": {
672 "readConcernLevel": "local",
673 "w": 1
674 },
675 "sessionOptions": {
676 "session0": {
677 "defaultTransactionOptions": {
678 "readConcern": {
679 "level": "majority"
680 },
681 "writeConcern": {
682 "w": "majority"
683 },
684 "maxCommitTimeMS": 60000
685 }
686 }
687 },
688 "operations": [
689 {
690 "name": "startTransaction",
691 "object": "session0"
692 },
693 {
694 "name": "insertOne",
695 "object": "collection",
696 "arguments": {
697 "session": "session0",
698 "document": {
699 "_id": 1
700 }
701 },
702 "result": {
703 "insertedId": 1
704 }
705 },
706 {
707 "name": "commitTransaction",
708 "object": "session0"
709 },
710 {
711 "name": "startTransaction",
712 "object": "session0"
713 },
714 {
715 "name": "insertOne",
716 "object": "collection",
717 "arguments": {
718 "session": "session0",
719 "document": {
720 "_id": 2
721 }
722 },
723 "result": {
724 "insertedId": 2
725 }
726 },
727 {
728 "name": "abortTransaction",
729 "object": "session0"
730 }
731 ],
732 "expectations": [
733 {
734 "command_started_event": {
735 "command": {
736 "insert": "test",
737 "documents": [
738 {
739 "_id": 1
740 }
741 ],
742 "ordered": true,
743 "lsid": "session0",
744 "txnNumber": {
745 "$numberLong": "1"
746 },
747 "startTransaction": true,
748 "autocommit": false,
749 "readConcern": {
750 "level": "majority"
751 },
752 "writeConcern": null,
753 "maxTimeMS": null
754 },
755 "command_name": "insert",
756 "database_name": "transaction-tests"
757 }
758 },
759 {
760 "command_started_event": {
761 "command": {
762 "commitTransaction": 1,
763 "lsid": "session0",
764 "txnNumber": {
765 "$numberLong": "1"
766 },
767 "startTransaction": null,
768 "autocommit": false,
769 "readConcern": null,
770 "writeConcern": {
771 "w": "majority"
772 },
773 "maxTimeMS": 60000
774 },
775 "command_name": "commitTransaction",
776 "database_name": "admin"
777 }
778 },
779 {
780 "command_started_event": {
781 "command": {
782 "insert": "test",
783 "documents": [
784 {
785 "_id": 2
786 }
787 ],
788 "ordered": true,
789 "lsid": "session0",
790 "txnNumber": {
791 "$numberLong": "2"
792 },
793 "startTransaction": true,
794 "autocommit": false,
795 "readConcern": {
796 "level": "majority",
797 "afterClusterTime": 42
798 },
799 "writeConcern": null,
800 "maxTimeMS": null
801 },
802 "command_name": "insert",
803 "database_name": "transaction-tests"
804 }
805 },
806 {
807 "command_started_event": {
808 "command": {
809 "abortTransaction": 1,
810 "lsid": "session0",
811 "txnNumber": {
812 "$numberLong": "2"
813 },
814 "startTransaction": null,
815 "autocommit": false,
816 "readConcern": null,
817 "writeConcern": {
818 "w": "majority"
819 },
820 "maxTimeMS": null
821 },
822 "command_name": "abortTransaction",
823 "database_name": "admin"
824 }
825 }
826 ],
827 "outcome": {
828 "collection": {
829 "data": [
830 {
831 "_id": 1
832 }
833 ]
834 }
835 }
836 },
837 {
838 "description": "readConcern local in defaultTransactionOptions",
839 "clientOptions": {
840 "w": 1
841 },
842 "sessionOptions": {
843 "session0": {
844 "defaultTransactionOptions": {
845 "readConcern": {
846 "level": "local"
847 }
848 }
849 }
850 },
851 "operations": [
852 {
853 "name": "startTransaction",
854 "object": "session0"
855 },
856 {
857 "name": "insertOne",
858 "object": "collection",
859 "arguments": {
860 "session": "session0",
861 "document": {
862 "_id": 1
863 }
864 },
865 "result": {
866 "insertedId": 1
867 }
868 },
869 {
870 "name": "commitTransaction",
871 "object": "session0"
872 },
873 {
874 "name": "startTransaction",
875 "object": "session0"
876 },
877 {
878 "name": "insertOne",
879 "object": "collection",
880 "arguments": {
881 "session": "session0",
882 "document": {
883 "_id": 2
884 }
885 },
886 "result": {
887 "insertedId": 2
888 }
889 },
890 {
891 "name": "abortTransaction",
892 "object": "session0"
893 }
894 ],
895 "expectations": [
896 {
897 "command_started_event": {
898 "command": {
899 "insert": "test",
900 "documents": [
901 {
902 "_id": 1
903 }
904 ],
905 "ordered": true,
906 "lsid": "session0",
907 "txnNumber": {
908 "$numberLong": "1"
909 },
910 "startTransaction": true,
911 "autocommit": false,
912 "readConcern": {
913 "level": "local"
914 },
915 "writeConcern": null
916 },
917 "command_name": "insert",
918 "database_name": "transaction-tests"
919 }
920 },
921 {
922 "command_started_event": {
923 "command": {
924 "commitTransaction": 1,
925 "lsid": "session0",
926 "txnNumber": {
927 "$numberLong": "1"
928 },
929 "startTransaction": null,
930 "autocommit": false,
931 "readConcern": null,
932 "writeConcern": {
933 "w": 1
934 }
935 },
936 "command_name": "commitTransaction",
937 "database_name": "admin"
938 }
939 },
940 {
941 "command_started_event": {
942 "command": {
943 "insert": "test",
944 "documents": [
945 {
946 "_id": 2
947 }
948 ],
949 "ordered": true,
950 "lsid": "session0",
951 "txnNumber": {
952 "$numberLong": "2"
953 },
954 "startTransaction": true,
955 "autocommit": false,
956 "readConcern": {
957 "level": "local",
958 "afterClusterTime": 42
959 },
960 "writeConcern": null
961 },
962 "command_name": "insert",
963 "database_name": "transaction-tests"
964 }
965 },
966 {
967 "command_started_event": {
968 "command": {
969 "abortTransaction": 1,
970 "lsid": "session0",
971 "txnNumber": {
972 "$numberLong": "2"
973 },
974 "startTransaction": null,
975 "autocommit": false,
976 "readConcern": null,
977 "writeConcern": {
978 "w": 1
979 }
980 },
981 "command_name": "abortTransaction",
982 "database_name": "admin"
983 }
984 }
985 ],
986 "outcome": {
987 "collection": {
988 "data": [
989 {
990 "_id": 1
991 }
992 ]
993 }
994 }
995 },
996 {
997 "description": "client writeConcern ignored for bulk",
998 "clientOptions": {
999 "w": "majority"
1000 },
1001 "operations": [
1002 {
1003 "name": "startTransaction",
1004 "object": "session0",
1005 "arguments": {
1006 "options": {
1007 "writeConcern": {
1008 "w": 1
1009 }
1010 }
1011 }
1012 },
1013 {
1014 "name": "bulkWrite",
1015 "object": "collection",
1016 "arguments": {
1017 "requests": [
1018 {
1019 "name": "insertOne",
1020 "arguments": {
1021 "document": {
1022 "_id": 1
1023 }
1024 }
1025 }
1026 ],
1027 "session": "session0"
1028 },
1029 "result": {
1030 "deletedCount": 0,
1031 "insertedCount": 1,
1032 "insertedIds": {
1033 "0": 1
1034 },
1035 "matchedCount": 0,
1036 "modifiedCount": 0,
1037 "upsertedCount": 0,
1038 "upsertedIds": {}
1039 }
1040 },
1041 {
1042 "name": "commitTransaction",
1043 "object": "session0"
1044 }
1045 ],
1046 "expectations": [
1047 {
1048 "command_started_event": {
1049 "command": {
1050 "insert": "test",
1051 "documents": [
1052 {
1053 "_id": 1
1054 }
1055 ],
1056 "ordered": true,
1057 "readConcern": null,
1058 "lsid": "session0",
1059 "txnNumber": {
1060 "$numberLong": "1"
1061 },
1062 "startTransaction": true,
1063 "autocommit": false,
1064 "writeConcern": null
1065 },
1066 "command_name": "insert",
1067 "database_name": "transaction-tests"
1068 }
1069 },
1070 {
1071 "command_started_event": {
1072 "command": {
1073 "commitTransaction": 1,
1074 "lsid": "session0",
1075 "txnNumber": {
1076 "$numberLong": "1"
1077 },
1078 "startTransaction": null,
1079 "autocommit": false,
1080 "writeConcern": {
1081 "w": 1
1082 }
1083 },
1084 "command_name": "commitTransaction",
1085 "database_name": "admin"
1086 }
1087 }
1088 ],
1089 "outcome": {
1090 "collection": {
1091 "data": [
1092 {
1093 "_id": 1
1094 }
1095 ]
1096 }
1097 }
1098 },
1099 {
1100 "description": "readPreference inherited from client",
1101 "clientOptions": {
1102 "readPreference": "secondary"
1103 },
1104 "operations": [
1105 {
1106 "name": "startTransaction",
1107 "object": "session0"
1108 },
1109 {
1110 "name": "insertOne",
1111 "object": "collection",
1112 "arguments": {
1113 "session": "session0",
1114 "document": {
1115 "_id": 1
1116 }
1117 },
1118 "result": {
1119 "insertedId": 1
1120 }
1121 },
1122 {
1123 "name": "find",
1124 "object": "collection",
1125 "arguments": {
1126 "session": "session0",
1127 "filter": {
1128 "_id": 1
1129 }
1130 },
1131 "result": {
1132 "errorContains": "read preference in a transaction must be primary"
1133 }
1134 },
1135 {
1136 "name": "commitTransaction",
1137 "object": "session0"
1138 }
1139 ],
1140 "expectations": [
1141 {
1142 "command_started_event": {
1143 "command": {
1144 "insert": "test",
1145 "documents": [
1146 {
1147 "_id": 1
1148 }
1149 ],
1150 "ordered": true,
1151 "lsid": "session0",
1152 "txnNumber": {
1153 "$numberLong": "1"
1154 },
1155 "startTransaction": true,
1156 "autocommit": false,
1157 "readConcern": null,
1158 "writeConcern": null
1159 },
1160 "command_name": "insert",
1161 "database_name": "transaction-tests"
1162 }
1163 },
1164 {
1165 "command_started_event": {
1166 "command": {
1167 "commitTransaction": 1,
1168 "lsid": "session0",
1169 "txnNumber": {
1170 "$numberLong": "1"
1171 },
1172 "startTransaction": null,
1173 "autocommit": false,
1174 "readConcern": null,
1175 "writeConcern": null
1176 },
1177 "command_name": "commitTransaction",
1178 "database_name": "admin"
1179 }
1180 }
1181 ],
1182 "outcome": {
1183 "collection": {
1184 "data": [
1185 {
1186 "_id": 1
1187 }
1188 ]
1189 }
1190 }
1191 },
1192 {
1193 "description": "readPreference inherited from defaultTransactionOptions",
1194 "clientOptions": {
1195 "readPreference": "primary"
1196 },
1197 "sessionOptions": {
1198 "session0": {
1199 "defaultTransactionOptions": {
1200 "readPreference": {
1201 "mode": "Secondary"
1202 }
1203 }
1204 }
1205 },
1206 "operations": [
1207 {
1208 "name": "startTransaction",
1209 "object": "session0"
1210 },
1211 {
1212 "name": "insertOne",
1213 "object": "collection",
1214 "arguments": {
1215 "session": "session0",
1216 "document": {
1217 "_id": 1
1218 }
1219 },
1220 "result": {
1221 "insertedId": 1
1222 }
1223 },
1224 {
1225 "name": "find",
1226 "object": "collection",
1227 "arguments": {
1228 "session": "session0",
1229 "filter": {
1230 "_id": 1
1231 }
1232 },
1233 "result": {
1234 "errorContains": "read preference in a transaction must be primary"
1235 }
1236 },
1237 {
1238 "name": "commitTransaction",
1239 "object": "session0"
1240 }
1241 ],
1242 "expectations": [
1243 {
1244 "command_started_event": {
1245 "command": {
1246 "insert": "test",
1247 "documents": [
1248 {
1249 "_id": 1
1250 }
1251 ],
1252 "ordered": true,
1253 "lsid": "session0",
1254 "txnNumber": {
1255 "$numberLong": "1"
1256 },
1257 "startTransaction": true,
1258 "autocommit": false,
1259 "readConcern": null,
1260 "writeConcern": null
1261 },
1262 "command_name": "insert",
1263 "database_name": "transaction-tests"
1264 }
1265 },
1266 {
1267 "command_started_event": {
1268 "command": {
1269 "commitTransaction": 1,
1270 "lsid": "session0",
1271 "txnNumber": {
1272 "$numberLong": "1"
1273 },
1274 "startTransaction": null,
1275 "autocommit": false,
1276 "readConcern": null,
1277 "writeConcern": null
1278 },
1279 "command_name": "commitTransaction",
1280 "database_name": "admin"
1281 }
1282 }
1283 ],
1284 "outcome": {
1285 "collection": {
1286 "data": [
1287 {
1288 "_id": 1
1289 }
1290 ]
1291 }
1292 }
1293 },
1294 {
1295 "description": "startTransaction overrides readPreference",
1296 "clientOptions": {
1297 "readPreference": "primary"
1298 },
1299 "sessionOptions": {
1300 "session0": {
1301 "defaultTransactionOptions": {
1302 "readPreference": {
1303 "mode": "Primary"
1304 }
1305 }
1306 }
1307 },
1308 "operations": [
1309 {
1310 "name": "startTransaction",
1311 "object": "session0",
1312 "arguments": {
1313 "options": {
1314 "readPreference": {
1315 "mode": "Secondary"
1316 }
1317 }
1318 }
1319 },
1320 {
1321 "name": "insertOne",
1322 "object": "collection",
1323 "arguments": {
1324 "session": "session0",
1325 "document": {
1326 "_id": 1
1327 }
1328 },
1329 "result": {
1330 "insertedId": 1
1331 }
1332 },
1333 {
1334 "name": "find",
1335 "object": "collection",
1336 "arguments": {
1337 "session": "session0",
1338 "filter": {
1339 "_id": 1
1340 }
1341 },
1342 "result": {
1343 "errorContains": "read preference in a transaction must be primary"
1344 }
1345 },
1346 {
1347 "name": "commitTransaction",
1348 "object": "session0"
1349 }
1350 ],
1351 "expectations": [
1352 {
1353 "command_started_event": {
1354 "command": {
1355 "insert": "test",
1356 "documents": [
1357 {
1358 "_id": 1
1359 }
1360 ],
1361 "ordered": true,
1362 "lsid": "session0",
1363 "txnNumber": {
1364 "$numberLong": "1"
1365 },
1366 "startTransaction": true,
1367 "autocommit": false,
1368 "readConcern": null,
1369 "writeConcern": null
1370 },
1371 "command_name": "insert",
1372 "database_name": "transaction-tests"
1373 }
1374 },
1375 {
1376 "command_started_event": {
1377 "command": {
1378 "commitTransaction": 1,
1379 "lsid": "session0",
1380 "txnNumber": {
1381 "$numberLong": "1"
1382 },
1383 "startTransaction": null,
1384 "autocommit": false,
1385 "readConcern": null,
1386 "writeConcern": null
1387 },
1388 "command_name": "commitTransaction",
1389 "database_name": "admin"
1390 }
1391 }
1392 ],
1393 "outcome": {
1394 "collection": {
1395 "data": [
1396 {
1397 "_id": 1
1398 }
1399 ]
1400 }
1401 }
1402 }
1403 ]
1404 }