...

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

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

     1{
     2  "description": "BulkWrite updateMany-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 updateMany 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                "updateMany": {
    60                  "filter": {
    61                    "$expr": {
    62                      "$eq": [
    63                        "$_id",
    64                        "$$id"
    65                      ]
    66                    }
    67                  },
    68                  "update": [
    69                    {
    70                      "$set": {
    71                        "x": 21
    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": 21
   106                          }
   107                        }
   108                      ],
   109                      "multi": true,
   110                      "upsert": {
   111                        "$$unsetOrMatches": false
   112                      }
   113                    }
   114                  ],
   115                  "let": {
   116                    "id": 1
   117                  }
   118                }
   119              }
   120            }
   121          ]
   122        }
   123      ],
   124      "outcome": [
   125        {
   126          "collectionName": "coll0",
   127          "databaseName": "crud-tests",
   128          "documents": [
   129            {
   130              "_id": 1,
   131              "x": 21
   132            },
   133            {
   134              "_id": 2,
   135              "x": 21
   136            }
   137          ]
   138        }
   139      ]
   140    },
   141    {
   142      "description": "BulkWrite updateMany with let option unsupported (server-side error)",
   143      "runOnRequirements": [
   144        {
   145          "minServerVersion": "4.2.0",
   146          "maxServerVersion": "4.9"
   147        }
   148      ],
   149      "operations": [
   150        {
   151          "object": "collection0",
   152          "name": "bulkWrite",
   153          "arguments": {
   154            "requests": [
   155              {
   156                "updateMany": {
   157                  "filter": {
   158                    "$expr": {
   159                      "$eq": [
   160                        "$_id",
   161                        "$$id"
   162                      ]
   163                    }
   164                  },
   165                  "update": [
   166                    {
   167                      "$set": {
   168                        "x": 21
   169                      }
   170                    }
   171                  ]
   172                }
   173              }
   174            ],
   175            "let": {
   176              "id": 1
   177            }
   178          },
   179          "expectError": {
   180            "errorContains": "'update.let' is an unknown field",
   181            "isClientError": false
   182          }
   183        }
   184      ],
   185      "expectEvents": [
   186        {
   187          "client": "client0",
   188          "events": [
   189            {
   190              "commandStartedEvent": {
   191                "command": {
   192                  "update": "coll0",
   193                  "updates": [
   194                    {
   195                      "q": {
   196                        "$expr": {
   197                          "$eq": [
   198                            "$_id",
   199                            "$$id"
   200                          ]
   201                        }
   202                      },
   203                      "u": [
   204                        {
   205                          "$set": {
   206                            "x": 21
   207                          }
   208                        }
   209                      ],
   210                      "multi": true,
   211                      "upsert": {
   212                        "$$unsetOrMatches": false
   213                      }
   214                    }
   215                  ],
   216                  "let": {
   217                    "id": 1
   218                  }
   219                }
   220              }
   221            }
   222          ]
   223        }
   224      ],
   225      "outcome": [
   226        {
   227          "collectionName": "coll0",
   228          "databaseName": "crud-tests",
   229          "documents": [
   230            {
   231              "_id": 1,
   232              "x": 20
   233            },
   234            {
   235              "_id": 2,
   236              "x": 21
   237            }
   238          ]
   239        }
   240      ]
   241    }
   242  ]
   243}

View as plain text