{
  "runOn": [
    {
      "minServerVersion": "4.3.4",
      "topology": [
        "replicaset",
        "sharded"
      ]
    }
  ],
  "database_name": "transaction-tests",
  "collection_name": "test",
  "data": [],
  "tests": [
    {
      "description": "create index on a non-existing collection",
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "test"
          }
        },
        {
          "name": "startTransaction",
          "object": "session0"
        },
        {
          "name": "createIndex",
          "object": "collection",
          "arguments": {
            "session": "session0",
            "name": "t_1",
            "keys": {
              "x": 1
            }
          }
        },
        {
          "name": "assertIndexNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "transaction-tests",
            "collection": "test",
            "index": "t_1"
          }
        },
        {
          "name": "commitTransaction",
          "object": "session0"
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "transaction-tests",
            "collection": "test",
            "index": "t_1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "test",
              "writeConcern": null
            },
            "command_name": "drop",
            "database_name": "transaction-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "test",
              "indexes": [
                {
                  "name": "t_1",
                  "key": {
                    "x": 1
                  }
                }
              ],
              "lsid": "session0",
              "txnNumber": {
                "$numberLong": "1"
              },
              "startTransaction": true,
              "autocommit": false,
              "writeConcern": null
            },
            "command_name": "createIndexes",
            "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"
          }
        }
      ]
    },
    {
      "description": "create index on a collection created within the same transaction",
      "operations": [
        {
          "name": "dropCollection",
          "object": "database",
          "arguments": {
            "collection": "test"
          }
        },
        {
          "name": "startTransaction",
          "object": "session0"
        },
        {
          "name": "createCollection",
          "object": "database",
          "arguments": {
            "session": "session0",
            "collection": "test"
          }
        },
        {
          "name": "createIndex",
          "object": "collection",
          "arguments": {
            "session": "session0",
            "name": "t_1",
            "keys": {
              "x": 1
            }
          }
        },
        {
          "name": "assertIndexNotExists",
          "object": "testRunner",
          "arguments": {
            "database": "transaction-tests",
            "collection": "test",
            "index": "t_1"
          }
        },
        {
          "name": "commitTransaction",
          "object": "session0"
        },
        {
          "name": "assertIndexExists",
          "object": "testRunner",
          "arguments": {
            "database": "transaction-tests",
            "collection": "test",
            "index": "t_1"
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "drop": "test",
              "writeConcern": null
            },
            "command_name": "drop",
            "database_name": "transaction-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "create": "test",
              "lsid": "session0",
              "txnNumber": {
                "$numberLong": "1"
              },
              "startTransaction": true,
              "autocommit": false,
              "writeConcern": null
            },
            "command_name": "create",
            "database_name": "transaction-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "createIndexes": "test",
              "indexes": [
                {
                  "name": "t_1",
                  "key": {
                    "x": 1
                  }
                }
              ],
              "lsid": "session0",
              "writeConcern": null
            },
            "command_name": "createIndexes",
            "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"
          }
        }
      ]
    }
  ]
}