{
  "description": "unacknowledged-client-bulkWrite",
  "schemaVersion": "1.7",
  "runOnRequirements": [
    {
      "minServerVersion": "8.0",
      "serverless": "forbid"
    }
  ],
  "createEntities": [
    {
      "client": {
        "id": "client",
        "useMultipleMongoses": false,
        "observeEvents": [
          "commandStartedEvent",
          "commandSucceededEvent",
          "commandFailedEvent"
        ],
        "uriOptions": {
          "w": 0
        }
      }
    },
    {
      "database": {
        "id": "database",
        "client": "client",
        "databaseName": "command-monitoring-tests"
      }
    },
    {
      "collection": {
        "id": "collection",
        "database": "database",
        "collectionName": "test"
      }
    }
  ],
  "initialData": [
    {
      "collectionName": "test",
      "databaseName": "command-monitoring-tests",
      "documents": [
        {
          "_id": 1,
          "x": 11
        },
        {
          "_id": 2,
          "x": 22
        },
        {
          "_id": 3,
          "x": 33
        }
      ]
    }
  ],
  "_yamlAnchors": {
    "namespace": "command-monitoring-tests.test"
  },
  "tests": [
    {
      "description": "A successful mixed client bulkWrite",
      "operations": [
        {
          "object": "client",
          "name": "clientBulkWrite",
          "arguments": {
            "models": [
              {
                "insertOne": {
                  "namespace": "command-monitoring-tests.test",
                  "document": {
                    "_id": 4,
                    "x": 44
                  }
                }
              },
              {
                "updateOne": {
                  "namespace": "command-monitoring-tests.test",
                  "filter": {
                    "_id": 3
                  },
                  "update": {
                    "$set": {
                      "x": 333
                    }
                  }
                }
              }
            ],
            "ordered": false
          },
          "expectResult": {
            "insertedCount": {
              "$$unsetOrMatches": 0
            },
            "upsertedCount": {
              "$$unsetOrMatches": 0
            },
            "matchedCount": {
              "$$unsetOrMatches": 0
            },
            "modifiedCount": {
              "$$unsetOrMatches": 0
            },
            "deletedCount": {
              "$$unsetOrMatches": 0
            },
            "insertResults": {
              "$$unsetOrMatches": {}
            },
            "updateResults": {
              "$$unsetOrMatches": {}
            },
            "deleteResults": {
              "$$unsetOrMatches": {}
            }
          }
        },
        {
          "object": "collection",
          "name": "find",
          "arguments": {
            "filter": {}
          },
          "expectResult": [
            {
              "_id": 1,
              "x": 11
            },
            {
              "_id": 2,
              "x": 22
            },
            {
              "_id": 3,
              "x": 333
            },
            {
              "_id": 4,
              "x": 44
            }
          ]
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "ignoreExtraEvents": true,
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "bulkWrite",
                "databaseName": "admin",
                "command": {
                  "bulkWrite": 1,
                  "errorsOnly": true,
                  "ordered": false,
                  "ops": [
                    {
                      "insert": 0,
                      "document": {
                        "_id": 4,
                        "x": 44
                      }
                    },
                    {
                      "update": 0,
                      "filter": {
                        "_id": 3
                      },
                      "updateMods": {
                        "$set": {
                          "x": 333
                        }
                      },
                      "multi": false
                    }
                  ],
                  "nsInfo": [
                    {
                      "ns": "command-monitoring-tests.test"
                    }
                  ]
                }
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "bulkWrite",
                "reply": {
                  "ok": 1,
                  "nInserted": {
                    "$$exists": false
                  },
                  "nMatched": {
                    "$$exists": false
                  },
                  "nModified": {
                    "$$exists": false
                  },
                  "nUpserted": {
                    "$$exists": false
                  },
                  "nDeleted": {
                    "$$exists": false
                  }
                }
              }
            }
          ]
        }
      ]
    }
  ]
}
