{
  "description": "deleteMany-comment",
  "schemaVersion": "1.0",
  "createEntities": [
    {
      "client": {
        "id": "client0",
        "observeEvents": [
          "commandStartedEvent"
        ]
      }
    },
    {
      "database": {
        "id": "database0",
        "client": "client0",
        "databaseName": "crud-tests"
      }
    },
    {
      "collection": {
        "id": "collection0",
        "database": "database0",
        "collectionName": "coll0"
      }
    }
  ],
  "initialData": [
    {
      "collectionName": "coll0",
      "databaseName": "crud-tests",
      "documents": [
        {
          "_id": 1
        },
        {
          "_id": 2,
          "name": "name2"
        },
        {
          "_id": 3,
          "name": "name3"
        }
      ]
    }
  ],
  "tests": [
    {
      "description": "deleteMany with string comment",
      "runOnRequirements": [
        {
          "minServerVersion": "4.4"
        }
      ],
      "operations": [
        {
          "name": "deleteMany",
          "object": "collection0",
          "arguments": {
            "filter": {
              "_id": {
                "$gt": 1
              }
            },
            "comment": "comment"
          },
          "expectResult": {
            "deletedCount": 2
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "delete": "coll0",
                  "deletes": [
                    {
                      "q": {
                        "_id": {
                          "$gt": 1
                        }
                      },
                      "limit": 0
                    }
                  ],
                  "comment": "comment"
                }
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "coll0",
          "databaseName": "crud-tests",
          "documents": [
            {
              "_id": 1
            }
          ]
        }
      ]
    },
    {
      "description": "deleteMany with document comment",
      "runOnRequirements": [
        {
          "minServerVersion": "4.4"
        }
      ],
      "operations": [
        {
          "name": "deleteMany",
          "object": "collection0",
          "arguments": {
            "filter": {
              "_id": {
                "$gt": 1
              }
            },
            "comment": {
              "key": "value"
            }
          },
          "expectResult": {
            "deletedCount": 2
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "delete": "coll0",
                  "deletes": [
                    {
                      "q": {
                        "_id": {
                          "$gt": 1
                        }
                      },
                      "limit": 0
                    }
                  ],
                  "comment": {
                    "key": "value"
                  }
                }
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "coll0",
          "databaseName": "crud-tests",
          "documents": [
            {
              "_id": 1
            }
          ]
        }
      ]
    },
    {
      "description": "deleteMany with comment - pre 4.4",
      "runOnRequirements": [
        {
          "minServerVersion": "3.4.0",
          "maxServerVersion": "4.2.99"
        }
      ],
      "operations": [
        {
          "name": "deleteMany",
          "object": "collection0",
          "arguments": {
            "filter": {
              "_id": {
                "$gt": 1
              }
            },
            "comment": "comment"
          },
          "expectError": {
            "isClientError": false
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "delete": "coll0",
                  "deletes": [
                    {
                      "q": {
                        "_id": {
                          "$gt": 1
                        }
                      },
                      "limit": 0
                    }
                  ],
                  "comment": "comment"
                }
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "coll0",
          "databaseName": "crud-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2,
              "name": "name2"
            },
            {
              "_id": 3,
              "name": "name3"
            }
          ]
        }
      ]
    }
  ]
}
