mongo-python-driver/test/transactions/delete.json
Shane Harvey ca6a34f51d PYTHON-1508 SPEC-1097 Resync transaction tests
Database.command without a read_preference defaults to the
transaction's or Primary if the session is not in a transaction
Add runCommand transaction tests.
Update count tests.
2018-06-01 16:29:11 -07:00

314 lines
7.2 KiB
JSON

{
"database_name": "transaction-tests",
"collection_name": "test",
"data": [
{
"_id": 1
},
{
"_id": 2
},
{
"_id": 3
},
{
"_id": 4
},
{
"_id": 5
}
],
"tests": [
{
"description": "delete",
"operations": [
{
"name": "startTransaction",
"object": "session0"
},
{
"name": "deleteOne",
"object": "collection",
"arguments": {
"session": "session0",
"filter": {
"_id": 1
}
},
"result": {
"deletedCount": 1
}
},
{
"name": "deleteMany",
"object": "collection",
"arguments": {
"session": "session0",
"filter": {
"_id": {
"$lte": 3
}
}
},
"result": {
"deletedCount": 2
}
},
{
"name": "deleteOne",
"object": "collection",
"arguments": {
"session": "session0",
"filter": {
"_id": 4
}
},
"result": {
"deletedCount": 1
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": 1
},
"limit": 1
}
],
"ordered": true,
"readConcern": null,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"writeConcern": null
},
"command_name": "delete",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": {
"$lte": 3
}
},
"limit": 0
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"writeConcern": null
},
"command_name": "delete",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": 4
},
"limit": 1
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"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": [
{
"_id": 5
}
]
}
}
},
{
"description": "collection writeConcern ignored for delete",
"operations": [
{
"name": "startTransaction",
"object": "session0",
"arguments": {
"options": {
"writeConcern": {
"w": "majority"
}
}
}
},
{
"name": "deleteOne",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": "majority"
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": 1
}
},
"result": {
"deletedCount": 1
}
},
{
"name": "deleteMany",
"object": "collection",
"collectionOptions": {
"writeConcern": {
"w": "majority"
}
},
"arguments": {
"session": "session0",
"filter": {
"_id": {
"$lte": 3
}
}
},
"result": {
"deletedCount": 2
}
},
{
"name": "commitTransaction",
"object": "session0"
}
],
"expectations": [
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": 1
},
"limit": 1
}
],
"ordered": true,
"readConcern": null,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": true,
"autocommit": false,
"writeConcern": null
},
"command_name": "delete",
"database_name": "transaction-tests"
}
},
{
"command_started_event": {
"command": {
"delete": "test",
"deletes": [
{
"q": {
"_id": {
"$lte": 3
}
},
"limit": 0
}
],
"ordered": true,
"lsid": "session0",
"txnNumber": {
"$numberLong": "1"
},
"startTransaction": null,
"autocommit": false,
"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": {
"w": "majority"
}
},
"command_name": "commitTransaction",
"database_name": "admin"
}
}
]
}
]
}