...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/findOneAndReplace-comment.json

Documentation: go.mongodb.org/mongo-driver/testdata/crud/unified

     1{
     2    "description": "findOneAndReplace-comment",
     3    "schemaVersion": "1.0",
     4    "createEntities": [
     5      {
     6        "client": {
     7          "id": "client0",
     8          "observeEvents": [
     9            "commandStartedEvent"
    10          ]
    11        }
    12      },
    13      {
    14        "database": {
    15          "id": "database0",
    16          "client": "client0",
    17          "databaseName": "crud-tests"
    18        }
    19      },
    20      {
    21        "collection": {
    22          "id": "collection0",
    23          "database": "database0",
    24          "collectionName": "coll0"
    25        }
    26      }
    27    ],
    28    "initialData": [
    29      {
    30        "collectionName": "coll0",
    31        "databaseName": "crud-tests",
    32        "documents": [
    33          {
    34            "_id": 1
    35          },
    36          {
    37            "_id": 2
    38          }
    39        ]
    40      }
    41    ],
    42    "tests": [
    43      {
    44        "description": "findOneAndReplace with string comment",
    45        "runOnRequirements": [
    46          {
    47            "minServerVersion": "4.4"
    48          }
    49        ],
    50        "operations": [
    51          {
    52            "name": "findOneAndReplace",
    53            "object": "collection0",
    54            "arguments": {
    55              "filter": {
    56                "_id": 1
    57              },
    58              "replacement": {
    59                "x": 5
    60              },
    61              "comment": "comment"
    62            },
    63            "expectResult": {
    64              "_id": 1
    65            }
    66          }
    67        ],
    68        "expectEvents": [
    69          {
    70            "client": "client0",
    71            "events": [
    72              {
    73                "commandStartedEvent": {
    74                  "command": {
    75                    "findAndModify": "coll0",
    76                    "query": {
    77                      "_id": 1
    78                    },
    79                    "update": {
    80                      "x": 5
    81                    },
    82                    "comment": "comment"
    83                  }
    84                }
    85              }
    86            ]
    87          }
    88        ],
    89        "outcome": [
    90          {
    91            "collectionName": "coll0",
    92            "databaseName": "crud-tests",
    93            "documents": [
    94              {
    95                "_id": 1,
    96                "x": 5
    97              },
    98              {
    99                "_id": 2
   100              }
   101            ]
   102          }
   103        ]
   104      },
   105      {
   106        "description": "findOneAndReplace with document comment",
   107        "runOnRequirements": [
   108          {
   109            "minServerVersion": "4.4"
   110          }
   111        ],
   112        "operations": [
   113          {
   114            "name": "findOneAndReplace",
   115            "object": "collection0",
   116            "arguments": {
   117              "filter": {
   118                "_id": 1
   119              },
   120              "replacement": {
   121                "x": 5
   122              },
   123              "comment": {
   124                "key": "value"
   125              }
   126            },
   127            "expectResult": {
   128              "_id": 1
   129            }
   130          }
   131        ],
   132        "expectEvents": [
   133          {
   134            "client": "client0",
   135            "events": [
   136              {
   137                "commandStartedEvent": {
   138                  "command": {
   139                    "findAndModify": "coll0",
   140                    "query": {
   141                      "_id": 1
   142                    },
   143                    "update": {
   144                      "x": 5
   145                    },
   146                    "comment": {
   147                      "key": "value"
   148                    }
   149                  }
   150                }
   151              }
   152            ]
   153          }
   154        ],
   155        "outcome": [
   156          {
   157            "collectionName": "coll0",
   158            "databaseName": "crud-tests",
   159            "documents": [
   160              {
   161                "_id": 1,
   162                "x": 5
   163              },
   164              {
   165                "_id": 2
   166              }
   167            ]
   168          }
   169        ]
   170      },
   171      {
   172        "description": "findOneAndReplace with comment - pre 4.4",
   173        "runOnRequirements": [
   174          {
   175            "minServerVersion": "4.2.0",
   176            "maxServerVersion": "4.2.99"
   177          }
   178        ],
   179        "operations": [
   180          {
   181            "name": "findOneAndReplace",
   182            "object": "collection0",
   183            "arguments": {
   184              "filter": {
   185                "_id": 1
   186              },
   187              "replacement": {
   188                "x": 5
   189              },
   190              "comment": "comment"
   191            },
   192            "expectError": {
   193              "isClientError": false
   194            }
   195          }
   196        ],
   197        "expectEvents": [
   198          {
   199            "client": "client0",
   200            "events": [
   201              {
   202                "commandStartedEvent": {
   203                  "command": {
   204                    "findAndModify": "coll0",
   205                    "query": {
   206                      "_id": 1
   207                    },
   208                    "update": {
   209                      "x": 5
   210                    },
   211                    "comment": "comment"
   212                  }
   213                }
   214              }
   215            ]
   216          }
   217        ],
   218        "outcome": [
   219          {
   220            "collectionName": "coll0",
   221            "databaseName": "crud-tests",
   222            "documents": [
   223              {
   224                "_id": 1
   225              },
   226              {
   227                "_id": 2
   228              }
   229            ]
   230          }
   231        ]
   232      }
   233    ]
   234  }

View as plain text