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