| 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 | { |
| 20 | "_id": 1 |
| 21 | }, |
| 22 | { |
| 23 | "_id": 2 |
| 24 | }, |
| 25 | { |
| 26 | "_id": 3 |
| 27 | } |
| 28 | ], |
| 29 | "tests": [ |
| 30 | { |
| 31 | "description": "findOneAndReplace", |
| 32 | "operations": [ |
| 33 | { |
| 34 | "name": "startTransaction", |
| 35 | "object": "session0" |
| 36 | }, |
| 37 | { |
| 38 | "name": "findOneAndReplace", |
| 39 | "object": "collection", |
| 40 | "arguments": { |
| 41 | "session": "session0", |
| 42 | "filter": { |
| 43 | "_id": 3 |
| 44 | }, |
| 45 | "replacement": { |
| 46 | "x": 1 |
| 47 | }, |
| 48 | "returnDocument": "Before" |
| 49 | }, |
| 50 | "result": { |
| 51 | "_id": 3 |
| 52 | } |
| 53 | }, |
| 54 | { |
| 55 | "name": "findOneAndReplace", |
| 56 | "object": "collection", |
| 57 | "arguments": { |
| 58 | "session": "session0", |
| 59 | "filter": { |
| 60 | "_id": 4 |
| 61 | }, |
| 62 | "replacement": { |
| 63 | "x": 1 |
| 64 | }, |
| 65 | "upsert": true, |
| 66 | "returnDocument": "After" |
| 67 | }, |
| 68 | "result": { |
| 69 | "_id": 4, |
| 70 | "x": 1 |
| 71 | } |
| 72 | }, |
| 73 | { |
| 74 | "name": "commitTransaction", |
| 75 | "object": "session0" |
| 76 | } |
| 77 | ], |
| 78 | "expectations": [ |
| 79 | { |
| 80 | "command_started_event": { |
| 81 | "command": { |
| 82 | "findAndModify": "test", |
| 83 | "query": { |
| 84 | "_id": 3 |
| 85 | }, |
| 86 | "update": { |
| 87 | "x": 1 |
| 88 | }, |
| 89 | "new": false, |
| 90 | "lsid": "session0", |
| 91 | "txnNumber": { |
| 92 | "$numberLong": "1" |
| 93 | }, |
| 94 | "startTransaction": true, |
| 95 | "autocommit": false, |
| 96 | "readConcern": null, |
| 97 | "writeConcern": null |
| 98 | }, |
| 99 | "command_name": "findAndModify", |
| 100 | "database_name": "transaction-tests" |
| 101 | } |
| 102 | }, |
| 103 | { |
| 104 | "command_started_event": { |
| 105 | "command": { |
| 106 | "findAndModify": "test", |
| 107 | "query": { |
| 108 | "_id": 4 |
| 109 | }, |
| 110 | "update": { |
| 111 | "x": 1 |
| 112 | }, |
| 113 | "new": true, |
| 114 | "upsert": true, |
| 115 | "lsid": "session0", |
| 116 | "txnNumber": { |
| 117 | "$numberLong": "1" |
| 118 | }, |
| 119 | "startTransaction": null, |
| 120 | "autocommit": false, |
| 121 | "readConcern": null, |
| 122 | "writeConcern": null |
| 123 | }, |
| 124 | "command_name": "findAndModify", |
| 125 | "database_name": "transaction-tests" |
| 126 | } |
| 127 | }, |
| 128 | { |
| 129 | "command_started_event": { |
| 130 | "command": { |
| 131 | "commitTransaction": 1, |
| 132 | "lsid": "session0", |
| 133 | "txnNumber": { |
| 134 | "$numberLong": "1" |
| 135 | }, |
| 136 | "startTransaction": null, |
| 137 | "autocommit": false, |
| 138 | "readConcern": null, |
| 139 | "writeConcern": null |
| 140 | }, |
| 141 | "command_name": "commitTransaction", |
| 142 | "database_name": "admin" |
| 143 | } |
| 144 | } |
| 145 | ], |
| 146 | "outcome": { |
| 147 | "collection": { |
| 148 | "data": [ |
| 149 | { |
| 150 | "_id": 1 |
| 151 | }, |
| 152 | { |
| 153 | "_id": 2 |
| 154 | }, |
| 155 | { |
| 156 | "_id": 3, |
| 157 | "x": 1 |
| 158 | }, |
| 159 | { |
| 160 | "_id": 4, |
| 161 | "x": 1 |
| 162 | } |
| 163 | ] |
| 164 | } |
| 165 | } |
| 166 | }, |
| 167 | { |
| 168 | "description": "collection writeConcern ignored for findOneAndReplace", |
| 169 | "operations": [ |
| 170 | { |
| 171 | "name": "startTransaction", |
| 172 | "object": "session0", |
| 173 | "arguments": { |
| 174 | "options": { |
| 175 | "writeConcern": { |
| 176 | "w": "majority" |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | }, |
| 181 | { |
| 182 | "name": "findOneAndReplace", |
| 183 | "object": "collection", |
| 184 | "collectionOptions": { |
| 185 | "writeConcern": { |
| 186 | "w": "majority" |
| 187 | } |
| 188 | }, |
| 189 | "arguments": { |
| 190 | "session": "session0", |
| 191 | "filter": { |
| 192 | "_id": 3 |
| 193 | }, |
| 194 | "replacement": { |
| 195 | "x": 1 |
| 196 | }, |
| 197 | "returnDocument": "Before" |
| 198 | }, |
| 199 | "result": { |
| 200 | "_id": 3 |
| 201 | } |
| 202 | }, |
| 203 | { |
| 204 | "name": "commitTransaction", |
| 205 | "object": "session0" |
| 206 | } |
| 207 | ], |
| 208 | "expectations": [ |
| 209 | { |
| 210 | "command_started_event": { |
| 211 | "command": { |
| 212 | "findAndModify": "test", |
| 213 | "query": { |
| 214 | "_id": 3 |
| 215 | }, |
| 216 | "update": { |
| 217 | "x": 1 |
| 218 | }, |
| 219 | "new": false, |
| 220 | "lsid": "session0", |
| 221 | "txnNumber": { |
| 222 | "$numberLong": "1" |
| 223 | }, |
| 224 | "startTransaction": true, |
| 225 | "autocommit": false, |
| 226 | "readConcern": null, |
| 227 | "writeConcern": null |
| 228 | }, |
| 229 | "command_name": "findAndModify", |
| 230 | "database_name": "transaction-tests" |
| 231 | } |
| 232 | }, |
| 233 | { |
| 234 | "command_started_event": { |
| 235 | "command": { |
| 236 | "commitTransaction": 1, |
| 237 | "lsid": "session0", |
| 238 | "txnNumber": { |
| 239 | "$numberLong": "1" |
| 240 | }, |
| 241 | "startTransaction": null, |
| 242 | "autocommit": false, |
| 243 | "readConcern": null, |
| 244 | "writeConcern": { |
| 245 | "w": "majority" |
| 246 | } |
| 247 | }, |
| 248 | "command_name": "commitTransaction", |
| 249 | "database_name": "admin" |
| 250 | } |
| 251 | } |
| 252 | ] |
| 253 | } |
| 254 | ] |
| 255 | } |