...

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

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

     1{
     2  "description": "findOneAndUpdate-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": "findOneAndUpdate with string comment",
    45      "runOnRequirements": [
    46        {
    47          "minServerVersion": "4.4"
    48        }
    49      ],
    50      "operations": [
    51        {
    52          "name": "findOneAndUpdate",
    53          "object": "collection0",
    54          "arguments": {
    55            "filter": {
    56              "_id": 1
    57            },
    58            "update": [
    59              {
    60                "$set": {
    61                  "x": 5
    62                }
    63              }
    64            ],
    65            "comment": "comment"
    66          },
    67          "expectResult": {
    68            "_id": 1
    69          }
    70        }
    71      ],
    72      "expectEvents": [
    73        {
    74          "client": "client0",
    75          "events": [
    76            {
    77              "commandStartedEvent": {
    78                "command": {
    79                  "findAndModify": "coll0",
    80                  "query": {
    81                    "_id": 1
    82                  },
    83                  "update": [
    84                    {
    85                      "$set": {
    86                        "x": 5
    87                      }
    88                    }
    89                  ],
    90                  "comment": "comment"
    91                }
    92              }
    93            }
    94          ]
    95        }
    96      ]
    97    },
    98    {
    99      "description": "findOneAndUpdate with document comment",
   100      "runOnRequirements": [
   101        {
   102          "minServerVersion": "4.4"
   103        }
   104      ],
   105      "operations": [
   106        {
   107          "name": "findOneAndUpdate",
   108          "object": "collection0",
   109          "arguments": {
   110            "filter": {
   111              "_id": 1
   112            },
   113            "update": [
   114              {
   115                "$set": {
   116                  "x": 5
   117                }
   118              }
   119            ],
   120            "comment": {
   121              "key": "value"
   122            }
   123          },
   124          "expectResult": {
   125            "_id": 1
   126          }
   127        }
   128      ],
   129      "expectEvents": [
   130        {
   131          "client": "client0",
   132          "events": [
   133            {
   134              "commandStartedEvent": {
   135                "command": {
   136                  "findAndModify": "coll0",
   137                  "query": {
   138                    "_id": 1
   139                  },
   140                  "update": [
   141                    {
   142                      "$set": {
   143                        "x": 5
   144                      }
   145                    }
   146                  ],
   147                  "comment": {
   148                    "key": "value"
   149                  }
   150                }
   151              }
   152            }
   153          ]
   154        }
   155      ]
   156    },
   157    {
   158      "description": "findOneAndUpdate with comment - pre 4.4",
   159      "runOnRequirements": [
   160        {
   161          "minServerVersion": "4.2.0",
   162          "maxServerVersion": "4.2.99"
   163        }
   164      ],
   165      "operations": [
   166        {
   167          "name": "findOneAndUpdate",
   168          "object": "collection0",
   169          "arguments": {
   170            "filter": {
   171              "_id": 1
   172            },
   173            "update": [
   174              {
   175                "$set": {
   176                  "x": 5
   177                }
   178              }
   179            ],
   180            "comment": "comment"
   181          },
   182          "expectError": {
   183            "isClientError": false
   184          }
   185        }
   186      ],
   187      "expectEvents": [
   188        {
   189          "client": "client0",
   190          "events": [
   191            {
   192              "commandStartedEvent": {
   193                "command": {
   194                  "findAndModify": "coll0",
   195                  "query": {
   196                    "_id": 1
   197                  },
   198                  "update": [
   199                    {
   200                      "$set": {
   201                        "x": 5
   202                      }
   203                    }
   204                  ],
   205                  "comment": "comment"
   206                }
   207              }
   208            }
   209          ]
   210        }
   211      ],
   212      "outcome": [
   213        {
   214          "collectionName": "coll0",
   215          "databaseName": "crud-tests",
   216          "documents": [
   217            {
   218              "_id": 1
   219            },
   220            {
   221              "_id": 2
   222            }
   223          ]
   224        }
   225      ]
   226    }
   227  ]
   228}

View as plain text