{
"runOn": [
{
"minServerVersion": "4.0",
"topology": [
"replicaset"
]
},
{
"minServerVersion": "4.1.8",
"topology": [
"sharded"
]
}
],
"database_name": "withTransaction-tests",
"collection_name": "test",
"data": [],
"tests": [
{
"description": "withTransaction and no transaction options set",
"useMultipleMongoses": true,
"operations": [
{
"name": "withTransaction",
"object": "session0",
"arguments": {
"callback": {
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
}
]
}
}
}
],
"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": "withTransaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"autocommit": false,
"readConcern": null,
"startTransaction": null,
"writeConcern": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
},
{
"description": "withTransaction inherits transaction options from client",
"useMultipleMongoses": true,
"clientOptions": {
"readConcernLevel": "local",
"w": 1
},
"operations": [
{
"name": "withTransaction",
"object": "session0",
"arguments": {
"callback": {
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
}
]
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": {
"level": "local"
},
"writeConcern": null
},
"command_name": "insert",
"database_name": "withTransaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"autocommit": false,
"writeConcern": {
"w": 1
},
"readConcern": null,
"startTransaction": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
},
{
"description": "withTransaction inherits transaction options from defaultTransactionOptions",
"useMultipleMongoses": true,
"sessionOptions": {
"session0": {
"defaultTransactionOptions": {
"readConcern": {
"level": "snapshot"
},
"writeConcern": {
"w": 1
}
}
}
},
"operations": [
{
"name": "withTransaction",
"object": "session0",
"arguments": {
"callback": {
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
}
]
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": {
"level": "snapshot"
},
"writeConcern": null
},
"command_name": "insert",
"database_name": "withTransaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"autocommit": false,
"writeConcern": {
"w": 1
},
"readConcern": null,
"startTransaction": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
},
{
"description": "withTransaction explicit transaction options",
"useMultipleMongoses": true,
"operations": [
{
"name": "withTransaction",
"object": "session0",
"arguments": {
"callback": {
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
}
]
},
"options": {
"readConcern": {
"level": "snapshot"
},
"writeConcern": {
"w": 1
}
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": {
"level": "snapshot"
},
"writeConcern": null
},
"command_name": "insert",
"database_name": "withTransaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"autocommit": false,
"writeConcern": {
"w": 1
},
"readConcern": null,
"startTransaction": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
},
{
"description": "withTransaction explicit transaction options override defaultTransactionOptions",
"useMultipleMongoses": true,
"sessionOptions": {
"session0": {
"defaultTransactionOptions": {
"readConcern": {
"level": "majority"
},
"writeConcern": {
"w": "majority"
}
}
}
},
"operations": [
{
"name": "withTransaction",
"object": "session0",
"arguments": {
"callback": {
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
}
]
},
"options": {
"readConcern": {
"level": "snapshot"
},
"writeConcern": {
"w": 1
}
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": {
"level": "snapshot"
},
"writeConcern": null
},
"command_name": "insert",
"database_name": "withTransaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"autocommit": false,
"writeConcern": {
"w": 1
},
"readConcern": null,
"startTransaction": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
},
{
"description": "withTransaction explicit transaction options override client options",
"useMultipleMongoses": true,
"clientOptions": {
"readConcernLevel": "majority",
"w": "majority"
},
"operations": [
{
"name": "withTransaction",
"object": "session0",
"arguments": {
"callback": {
"operations": [
{
"name": "insertOne",
"object": "collection",
"arguments": {
"session": "session0",
"document": {
"_id": 1
}
},
"result": {
"insertedId": 1
}
}
]
},
"options": {
"readConcern": {
"level": "snapshot"
},
"writeConcern": {
"w": 1
}
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"readConcern": {
"level": "snapshot"
},
"writeConcern": null
},
"command_name": "insert",
"database_name": "withTransaction-tests"
}
},
{
"command_started_event": {
"command": {
"commitTransaction": 1,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"autocommit": false,
"writeConcern": {
"w": 1
},
"readConcern": null,
"startTransaction": null
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1
}
]
}
}
}
]
}
|