{
  "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
    },
    {
      "_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"
          }
        }
      ]
    }
  ]
}
