{
"runOn": [
{
"minServerVersion": "4.0",
"topology": [
"replicaset"
]
},
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
]
}
],
"database_name": "transaction-tests",
"collection_name": "test",
"data": [
{
"_id": 0
}
],
"tests": [
{
"description": "commit with majority",
"operations": [
{
"name": "startTransaction",
"object": "session0",
"arguments": {
"options": {
"writeConcern": {
"w": "majority"
}
}
}
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": {
"w": "majority"
}
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
},
{
"_id": 1
}
]
}
}
},
{
"description": "commit with default",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
},
{
"_id": 1
}
]
}
}
},
{
"description": "abort with majority",
"operations": [
{
"name": "startTransaction",
"object": "session0",
"arguments": {
"options": {
"writeConcern": {
"w": "majority"
}
}
}
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
},
{
"name": "abortTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"abortTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": {
"w": "majority"
}
},
"command_name": "abortTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
}
]
}
}
},
{
"description": "abort with default",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
},
{
"name": "abortTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"abortTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "abortTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
}
]
}
}
},
{
"description": "start with unacknowledged write concern",
"operations": [
{
"name": "startTransaction",
"object": "session0",
"arguments": {
"options": {
"writeConcern": {
"w": 0
}
}
},
"result": {
"errorContains": "transactions do not support unacknowledged write concern"
}
}
]
},
{
"description": "start with implicit unacknowledged write concern",
"clientOptions": {
"w": 0
},
"operations": [
{
"name": "startTransaction",
"object": "session0",
"result": {
"errorContains": "transactions do not support unacknowledged write concern"
}
}
]
},
{
"description": "unacknowledged write concern coll insertOne",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "insertOne",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
},
{
"_id": 1
}
]
}
}
},
{
"description": "unacknowledged write concern coll insertMany",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "insertMany",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"documents": [
{
"_id": 1
},
{
"_id": 2
}
]
},
"result": {
"insertedIds": {
"0": 1,
"1": 2
}
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
},
{
"_id": 2
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
},
{
"_id": 1
},
{
"_id": 2
}
]
}
}
},
{
"description": "unacknowledged write concern coll bulkWrite",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "bulkWrite",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"requests": [
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 1
}
}
}
]
},
"result": {
"deletedCount": 0,
"insertedCount": 1,
"insertedIds": {
"0": 1
},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "insert",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0
},
{
"_id": 1
}
]
}
}
},
{
"description": "unacknowledged write concern coll deleteOne",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "deleteOne",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
}
},
"result": {
"deletedCount": 1
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": 0
},
"limit": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "delete",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": []
}
}
},
{
"description": "unacknowledged write concern coll deleteMany",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "deleteMany",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
}
},
"result": {
"deletedCount": 1
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": 0
},
"limit": 0
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "delete",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": []
}
}
},
{
"description": "unacknowledged write concern coll updateOne",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "updateOne",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
},
"update": {
"$inc": {
"x": 1
}
},
"upsert": true
},
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test",
"updates": [
{
"q": {
"_id": 0
},
"u": {
"$inc": {
"x": 1
}
},
"multi": false,
"upsert": true
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "update",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0,
"x": 1
}
]
}
}
},
{
"description": "unacknowledged write concern coll updateMany",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "updateMany",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
},
"update": {
"$inc": {
"x": 1
}
},
"upsert": true
},
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test",
"updates": [
{
"q": {
"_id": 0
},
"u": {
"$inc": {
"x": 1
}
},
"multi": true,
"upsert": true
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": null,
"writeConcern": null
},
"command_name": "update",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0,
"x": 1
}
]
}
}
},
{
"description": "unacknowledged write concern coll findOneAndDelete",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "findOneAndDelete",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
}
},
"result": {
"_id": 0
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "test",
"query": {
"_id": 0
},
"remove": true,
"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,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": []
}
}
},
{
"description": "unacknowledged write concern coll findOneAndReplace",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "findOneAndReplace",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
},
"replacement": {
"x": 1
},
"returnDocument": "Before"
},
"result": {
"_id": 0
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "test",
"query": {
"_id": 0
},
"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,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0,
"x": 1
}
]
}
}
},
{
"description": "unacknowledged write concern coll findOneAndUpdate",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "findOneAndUpdate",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": 0
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 0
},
"update": {
"$inc": {
"x": 1
}
},
"returnDocument": "Before"
},
"result": {
"_id": 0
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"findAndModify": "test",
"query": {
"_id": 0
},
"update": {
"$inc": {
"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,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 0,
"x": 1
}
]
}
}
}
]
}
|