256 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			JSON
		
	
	
	
	
	
			
		
		
	
	
			256 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			JSON
		
	
	
	
	
	
| {
 | |
|   "runOn": [
 | |
|     {
 | |
|       "minServerVersion": "4.0",
 | |
|       "topology": [
 | |
|         "replicaset"
 | |
|       ]
 | |
|     },
 | |
|     {
 | |
|       "minServerVersion": "4.1.8",
 | |
|       "topology": [
 | |
|         "sharded"
 | |
|       ]
 | |
|     }
 | |
|   ],
 | |
|   "database_name": "transaction-tests",
 | |
|   "collection_name": "test",
 | |
|   "data": [
 | |
|     {
 | |
|       "_id": 1
 | |
|     },
 | |
|     {
 | |
|       "_id": 2
 | |
|     },
 | |
|     {
 | |
|       "_id": 3
 | |
|     }
 | |
|   ],
 | |
|   "tests": [
 | |
|     {
 | |
|       "description": "findOneAndReplace",
 | |
|       "operations": [
 | |
|         {
 | |
|           "name": "startTransaction",
 | |
|           "object": "session0"
 | |
|         },
 | |
|         {
 | |
|           "name": "findOneAndReplace",
 | |
|           "object": "collection",
 | |
|           "arguments": {
 | |
|             "session": "session0",
 | |
|             "filter": {
 | |
|               "_id": 3
 | |
|             },
 | |
|             "replacement": {
 | |
|               "x": 1
 | |
|             },
 | |
|             "returnDocument": "Before"
 | |
|           },
 | |
|           "result": {
 | |
|             "_id": 3
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "name": "findOneAndReplace",
 | |
|           "object": "collection",
 | |
|           "arguments": {
 | |
|             "session": "session0",
 | |
|             "filter": {
 | |
|               "_id": 4
 | |
|             },
 | |
|             "replacement": {
 | |
|               "x": 1
 | |
|             },
 | |
|             "upsert": true,
 | |
|             "returnDocument": "After"
 | |
|           },
 | |
|           "result": {
 | |
|             "_id": 4,
 | |
|             "x": 1
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "name": "commitTransaction",
 | |
|           "object": "session0"
 | |
|         }
 | |
|       ],
 | |
|       "expectations": [
 | |
|         {
 | |
|           "command_started_event": {
 | |
|             "command": {
 | |
|               "findAndModify": "test",
 | |
|               "query": {
 | |
|                 "_id": 3
 | |
|               },
 | |
|               "update": {
 | |
|                 "x": 1
 | |
|               },
 | |
|               "new": false,
 | |
|               "lsid": "session0",
 | |
|               "txnNumber": {
 | |
|                 "$numberLong": "1"
 | |
|               },
 | |
|               "startTransaction": true,
 | |
|               "autocommit": false,
 | |
|               "readConcern": null,
 | |
|               "writeConcern": null
 | |
|             },
 | |
|             "command_name": "findAndModify",
 | |
|             "database_name": "transaction-tests"
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "command_started_event": {
 | |
|             "command": {
 | |
|               "findAndModify": "test",
 | |
|               "query": {
 | |
|                 "_id": 4
 | |
|               },
 | |
|               "update": {
 | |
|                 "x": 1
 | |
|               },
 | |
|               "new": true,
 | |
|               "upsert": true,
 | |
|               "lsid": "session0",
 | |
|               "txnNumber": {
 | |
|                 "$numberLong": "1"
 | |
|               },
 | |
|               "startTransaction": null,
 | |
|               "autocommit": false,
 | |
|               "readConcern": null,
 | |
|               "writeConcern": null
 | |
|             },
 | |
|             "command_name": "findAndModify",
 | |
|             "database_name": "transaction-tests"
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "command_started_event": {
 | |
|             "command": {
 | |
|               "commitTransaction": 1,
 | |
|               "lsid": "session0",
 | |
|               "txnNumber": {
 | |
|                 "$numberLong": "1"
 | |
|               },
 | |
|               "startTransaction": null,
 | |
|               "autocommit": false,
 | |
|               "readConcern": null,
 | |
|               "writeConcern": null
 | |
|             },
 | |
|             "command_name": "commitTransaction",
 | |
|             "database_name": "admin"
 | |
|           }
 | |
|         }
 | |
|       ],
 | |
|       "outcome": {
 | |
|         "collection": {
 | |
|           "data": [
 | |
|             {
 | |
|               "_id": 1
 | |
|             },
 | |
|             {
 | |
|               "_id": 2
 | |
|             },
 | |
|             {
 | |
|               "_id": 3,
 | |
|               "x": 1
 | |
|             },
 | |
|             {
 | |
|               "_id": 4,
 | |
|               "x": 1
 | |
|             }
 | |
|           ]
 | |
|         }
 | |
|       }
 | |
|     },
 | |
|     {
 | |
|       "description": "collection writeConcern ignored for findOneAndReplace",
 | |
|       "operations": [
 | |
|         {
 | |
|           "name": "startTransaction",
 | |
|           "object": "session0",
 | |
|           "arguments": {
 | |
|             "options": {
 | |
|               "writeConcern": {
 | |
|                 "w": "majority"
 | |
|               }
 | |
|             }
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "name": "findOneAndReplace",
 | |
|           "object": "collection",
 | |
|           "collectionOptions": {
 | |
|             "writeConcern": {
 | |
|               "w": "majority"
 | |
|             }
 | |
|           },
 | |
|           "arguments": {
 | |
|             "session": "session0",
 | |
|             "filter": {
 | |
|               "_id": 3
 | |
|             },
 | |
|             "replacement": {
 | |
|               "x": 1
 | |
|             },
 | |
|             "returnDocument": "Before"
 | |
|           },
 | |
|           "result": {
 | |
|             "_id": 3
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "name": "commitTransaction",
 | |
|           "object": "session0"
 | |
|         }
 | |
|       ],
 | |
|       "expectations": [
 | |
|         {
 | |
|           "command_started_event": {
 | |
|             "command": {
 | |
|               "findAndModify": "test",
 | |
|               "query": {
 | |
|                 "_id": 3
 | |
|               },
 | |
|               "update": {
 | |
|                 "x": 1
 | |
|               },
 | |
|               "new": false,
 | |
|               "lsid": "session0",
 | |
|               "txnNumber": {
 | |
|                 "$numberLong": "1"
 | |
|               },
 | |
|               "startTransaction": true,
 | |
|               "autocommit": false,
 | |
|               "readConcern": null,
 | |
|               "writeConcern": null
 | |
|             },
 | |
|             "command_name": "findAndModify",
 | |
|             "database_name": "transaction-tests"
 | |
|           }
 | |
|         },
 | |
|         {
 | |
|           "command_started_event": {
 | |
|             "command": {
 | |
|               "commitTransaction": 1,
 | |
|               "lsid": "session0",
 | |
|               "txnNumber": {
 | |
|                 "$numberLong": "1"
 | |
|               },
 | |
|               "startTransaction": null,
 | |
|               "autocommit": false,
 | |
|               "readConcern": null,
 | |
|               "writeConcern": {
 | |
|                 "w": "majority"
 | |
|               }
 | |
|             },
 | |
|             "command_name": "commitTransaction",
 | |
|             "database_name": "admin"
 | |
|           }
 | |
|         }
 | |
|       ]
 | |
|     }
 | |
|   ]
 | |
| }
 |