{
  "runOn": [
    {
      "minServerVersion": "4.0",
      "topology": [
        "replicaset"
      ]
    },
    {
      "minServerVersion": "4.1.8",
      "topology": [
        "sharded"
      ]
    }
  ],
  "database_name": "transaction-tests",
  "collection_name": "test",
  "data": [
    {
      "_id": 1
    },
    {
      "_id": 2
    },
    {
      "_id": 3
    }
  ],
  "tests": [
    {
      "description": "findOneAndDelete",
      "operations": [
        {
          "name": "startTransaction",
          "object": "session0"
        },
        {
          "name": "findOneAndDelete",
          "object": "collection",
          "arguments": {
            "session": "session0",
            "filter": {
              "_id": 3
            }
          },
          "result": {
            "_id": 3
          }
        },
        {
          "name": "findOneAndDelete",
          "object": "collection",
          "arguments": {
            "session": "session0",
            "filter": {
              "_id": 4
            }
          },
          "result": null
        },
        {
          "name": "commitTransaction",
          "object": "session0"
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "findAndModify": "test",
              "query": {
                "_id": 3
              },
              "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": {
              "findAndModify": "test",
              "query": {
                "_id": 4
              },
              "remove": true,
              "lsid": "session0",
              "txnNumber": {
                "$numberLong": "1"
              },
              "startTransaction": null,
              "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,
              "readConcern": null,
              "writeConcern": null
            },
            "command_name": "commitTransaction",
            "database_name": "admin"
          }
        }
      ],
      "outcome": {
        "collection": {
          "data": [
            {
              "_id": 1
            },
            {
              "_id": 2
            }
          ]
        }
      }
    },
    {
      "description": "collection writeConcern ignored for findOneAndDelete",
      "operations": [
        {
          "name": "startTransaction",
          "object": "session0",
          "arguments": {
            "options": {
              "writeConcern": {
                "w": "majority"
              }
            }
          }
        },
        {
          "name": "findOneAndDelete",
          "object": "collection",
          "collectionOptions": {
            "writeConcern": {
              "w": "majority"
            }
          },
          "arguments": {
            "session": "session0",
            "filter": {
              "_id": 3
            }
          },
          "result": {
            "_id": 3
          }
        },
        {
          "name": "commitTransaction",
          "object": "session0"
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "findAndModify": "test",
              "query": {
                "_id": 3
              },
              "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,
              "readConcern": null,
              "writeConcern": {
                "w": "majority"
              }
            },
            "command_name": "commitTransaction",
            "database_name": "admin"
          }
        }
      ]
    }
  ]
}
