...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/bulkWrite-updateOne-let.json

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

     1{
     2  "description": "BulkWrite updateOne-let",
     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          "x": 20
    36        },
    37        {
    38          "_id": 2,
    39          "x": 21
    40        }
    41      ]
    42    }
    43  ],
    44  "tests": [
    45    {
    46      "description": "BulkWrite updateOne with let option",
    47      "runOnRequirements": [
    48        {
    49          "minServerVersion": "5.0"
    50        }
    51      ],
    52      "operations": [
    53        {
    54          "object": "collection0",
    55          "name": "bulkWrite",
    56          "arguments": {
    57            "requests": [
    58              {
    59                "updateOne": {
    60                  "filter": {
    61                    "$expr": {
    62                      "$eq": [
    63                        "$_id",
    64                        "$$id"
    65                      ]
    66                    }
    67                  },
    68                  "update": [
    69                    {
    70                      "$set": {
    71                        "x": 22
    72                      }
    73                    }
    74                  ]
    75                }
    76              }
    77            ],
    78            "let": {
    79              "id": 1
    80            }
    81          }
    82        }
    83      ],
    84      "expectEvents": [
    85        {
    86          "client": "client0",
    87          "events": [
    88            {
    89              "commandStartedEvent": {
    90                "command": {
    91                  "update": "coll0",
    92                  "updates": [
    93                    {
    94                      "q": {
    95                        "$expr": {
    96                          "$eq": [
    97                            "$_id",
    98                            "$$id"
    99                          ]
   100                        }
   101                      },
   102                      "u": [
   103                        {
   104                          "$set": {
   105                            "x": 22
   106                          }
   107                        }
   108                      ],
   109                      "multi": {
   110                        "$$unsetOrMatches": false
   111                      },
   112                      "upsert": {
   113                        "$$unsetOrMatches": false
   114                      }
   115                    }
   116                  ],
   117                  "let": {
   118                    "id": 1
   119                  }
   120                }
   121              }
   122            }
   123          ]
   124        }
   125      ],
   126      "outcome": [
   127        {
   128          "collectionName": "coll0",
   129          "databaseName": "crud-tests",
   130          "documents": [
   131            {
   132              "_id": 1,
   133              "x": 22
   134            },
   135            {
   136              "_id": 2,
   137              "x": 21
   138            }
   139          ]
   140        }
   141      ]
   142    },
   143    {
   144      "description": "BulkWrite updateOne with let option unsupported (server-side error)",
   145      "runOnRequirements": [
   146        {
   147          "minServerVersion": "4.2.0",
   148          "maxServerVersion": "4.9"
   149        }
   150      ],
   151      "operations": [
   152        {
   153          "object": "collection0",
   154          "name": "bulkWrite",
   155          "arguments": {
   156            "requests": [
   157              {
   158                "updateOne": {
   159                  "filter": {
   160                    "$expr": {
   161                      "$eq": [
   162                        "$_id",
   163                        "$$id"
   164                      ]
   165                    }
   166                  },
   167                  "update": [
   168                    {
   169                      "$set": {
   170                        "x": 22
   171                      }
   172                    }
   173                  ]
   174                }
   175              }
   176            ],
   177            "let": {
   178              "id": 1
   179            }
   180          },
   181          "expectError": {
   182            "errorContains": "'update.let' is an unknown field",
   183            "isClientError": false
   184          }
   185        }
   186      ],
   187      "expectEvents": [
   188        {
   189          "client": "client0",
   190          "events": [
   191            {
   192              "commandStartedEvent": {
   193                "command": {
   194                  "update": "coll0",
   195                  "updates": [
   196                    {
   197                      "q": {
   198                        "$expr": {
   199                          "$eq": [
   200                            "$_id",
   201                            "$$id"
   202                          ]
   203                        }
   204                      },
   205                      "u": [
   206                        {
   207                          "$set": {
   208                            "x": 22
   209                          }
   210                        }
   211                      ],
   212                      "multi": {
   213                        "$$unsetOrMatches": false
   214                      },
   215                      "upsert": {
   216                        "$$unsetOrMatches": false
   217                      }
   218                    }
   219                  ],
   220                  "let": {
   221                    "id": 1
   222                  }
   223                }
   224              }
   225            }
   226          ]
   227        }
   228      ],
   229      "outcome": [
   230        {
   231          "collectionName": "coll0",
   232          "databaseName": "crud-tests",
   233          "documents": [
   234            {
   235              "_id": 1,
   236              "x": 20
   237            },
   238            {
   239              "_id": 2,
   240              "x": 21
   241            }
   242          ]
   243        }
   244      ]
   245    }
   246  ]
   247}

View as plain text