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