{
    "description": "findOneAndReplace-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
          }
        ]
      }
    ],
    "tests": [
      {
        "description": "findOneAndReplace with string comment",
        "runOnRequirements": [
          {
            "minServerVersion": "4.4"
          }
        ],
        "operations": [
          {
            "name": "findOneAndReplace",
            "object": "collection0",
            "arguments": {
              "filter": {
                "_id": 1
              },
              "replacement": {
                "x": 5
              },
              "comment": "comment"
            },
            "expectResult": {
              "_id": 1
            }
          }
        ],
        "expectEvents": [
          {
            "client": "client0",
            "events": [
              {
                "commandStartedEvent": {
                  "command": {
                    "findAndModify": "coll0",
                    "query": {
                      "_id": 1
                    },
                    "update": {
                      "x": 5
                    },
                    "comment": "comment"
                  }
                }
              }
            ]
          }
        ],
        "outcome": [
          {
            "collectionName": "coll0",
            "databaseName": "crud-tests",
            "documents": [
              {
                "_id": 1,
                "x": 5
              },
              {
                "_id": 2
              }
            ]
          }
        ]
      },
      {
        "description": "findOneAndReplace with document comment",
        "runOnRequirements": [
          {
            "minServerVersion": "4.4"
          }
        ],
        "operations": [
          {
            "name": "findOneAndReplace",
            "object": "collection0",
            "arguments": {
              "filter": {
                "_id": 1
              },
              "replacement": {
                "x": 5
              },
              "comment": {
                "key": "value"
              }
            },
            "expectResult": {
              "_id": 1
            }
          }
        ],
        "expectEvents": [
          {
            "client": "client0",
            "events": [
              {
                "commandStartedEvent": {
                  "command": {
                    "findAndModify": "coll0",
                    "query": {
                      "_id": 1
                    },
                    "update": {
                      "x": 5
                    },
                    "comment": {
                      "key": "value"
                    }
                  }
                }
              }
            ]
          }
        ],
        "outcome": [
          {
            "collectionName": "coll0",
            "databaseName": "crud-tests",
            "documents": [
              {
                "_id": 1,
                "x": 5
              },
              {
                "_id": 2
              }
            ]
          }
        ]
      },
      {
        "description": "findOneAndReplace with comment - pre 4.4",
        "runOnRequirements": [
          {
            "minServerVersion": "4.2.0",
            "maxServerVersion": "4.2.99"
          }
        ],
        "operations": [
          {
            "name": "findOneAndReplace",
            "object": "collection0",
            "arguments": {
              "filter": {
                "_id": 1
              },
              "replacement": {
                "x": 5
              },
              "comment": "comment"
            },
            "expectError": {
              "isClientError": false
            }
          }
        ],
        "expectEvents": [
          {
            "client": "client0",
            "events": [
              {
                "commandStartedEvent": {
                  "command": {
                    "findAndModify": "coll0",
                    "query": {
                      "_id": 1
                    },
                    "update": {
                      "x": 5
                    },
                    "comment": "comment"
                  }
                }
              }
            ]
          }
        ],
        "outcome": [
          {
            "collectionName": "coll0",
            "databaseName": "crud-tests",
            "documents": [
              {
                "_id": 1
              },
              {
                "_id": 2
              }
            ]
          }
        ]
      }
    ]
  }