...

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

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

     1{
     2  "description": "bulkWrite-arrayFilters",
     3  "schemaVersion": "1.0",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "3.5.6"
     7    }
     8  ],
     9  "createEntities": [
    10    {
    11      "client": {
    12        "id": "client0",
    13        "observeEvents": [
    14          "commandStartedEvent"
    15        ]
    16      }
    17    },
    18    {
    19      "database": {
    20        "id": "database0",
    21        "client": "client0",
    22        "databaseName": "crud-tests"
    23      }
    24    },
    25    {
    26      "collection": {
    27        "id": "collection0",
    28        "database": "database0",
    29        "collectionName": "test"
    30      }
    31    }
    32  ],
    33  "initialData": [
    34    {
    35      "collectionName": "test",
    36      "databaseName": "crud-tests",
    37      "documents": [
    38        {
    39          "_id": 1,
    40          "y": [
    41            {
    42              "b": 3
    43            },
    44            {
    45              "b": 1
    46            }
    47          ]
    48        },
    49        {
    50          "_id": 2,
    51          "y": [
    52            {
    53              "b": 0
    54            },
    55            {
    56              "b": 1
    57            }
    58          ]
    59        }
    60      ]
    61    }
    62  ],
    63  "tests": [
    64    {
    65      "description": "BulkWrite updateOne with arrayFilters",
    66      "operations": [
    67        {
    68          "object": "collection0",
    69          "name": "bulkWrite",
    70          "arguments": {
    71            "requests": [
    72              {
    73                "updateOne": {
    74                  "filter": {},
    75                  "update": {
    76                    "$set": {
    77                      "y.$[i].b": 2
    78                    }
    79                  },
    80                  "arrayFilters": [
    81                    {
    82                      "i.b": 3
    83                    }
    84                  ]
    85                }
    86              }
    87            ],
    88            "ordered": true
    89          },
    90          "expectResult": {
    91            "deletedCount": 0,
    92            "insertedCount": 0,
    93            "insertedIds": {
    94              "$$unsetOrMatches": {}
    95            },
    96            "matchedCount": 1,
    97            "modifiedCount": 1,
    98            "upsertedCount": 0,
    99            "upsertedIds": {}
   100          }
   101        }
   102      ],
   103      "expectEvents": [
   104        {
   105          "client": "client0",
   106          "events": [
   107            {
   108              "commandStartedEvent": {
   109                "command": {
   110                  "update": "test",
   111                  "updates": [
   112                    {
   113                      "q": {},
   114                      "u": {
   115                        "$set": {
   116                          "y.$[i].b": 2
   117                        }
   118                      },
   119                      "multi": {
   120                        "$$unsetOrMatches": false
   121                      },
   122                      "upsert": {
   123                        "$$unsetOrMatches": false
   124                      },
   125                      "arrayFilters": [
   126                        {
   127                          "i.b": 3
   128                        }
   129                      ]
   130                    }
   131                  ],
   132                  "ordered": true
   133                },
   134                "commandName": "update",
   135                "databaseName": "crud-tests"
   136              }
   137            }
   138          ]
   139        }
   140      ],
   141      "outcome": [
   142        {
   143          "collectionName": "test",
   144          "databaseName": "crud-tests",
   145          "documents": [
   146            {
   147              "_id": 1,
   148              "y": [
   149                {
   150                  "b": 2
   151                },
   152                {
   153                  "b": 1
   154                }
   155              ]
   156            },
   157            {
   158              "_id": 2,
   159              "y": [
   160                {
   161                  "b": 0
   162                },
   163                {
   164                  "b": 1
   165                }
   166              ]
   167            }
   168          ]
   169        }
   170      ]
   171    },
   172    {
   173      "description": "BulkWrite updateMany with arrayFilters",
   174      "operations": [
   175        {
   176          "object": "collection0",
   177          "name": "bulkWrite",
   178          "arguments": {
   179            "requests": [
   180              {
   181                "updateMany": {
   182                  "filter": {},
   183                  "update": {
   184                    "$set": {
   185                      "y.$[i].b": 2
   186                    }
   187                  },
   188                  "arrayFilters": [
   189                    {
   190                      "i.b": 1
   191                    }
   192                  ]
   193                }
   194              }
   195            ],
   196            "ordered": true
   197          },
   198          "expectResult": {
   199            "deletedCount": 0,
   200            "insertedCount": 0,
   201            "insertedIds": {
   202              "$$unsetOrMatches": {}
   203            },
   204            "matchedCount": 2,
   205            "modifiedCount": 2,
   206            "upsertedCount": 0,
   207            "upsertedIds": {}
   208          }
   209        }
   210      ],
   211      "expectEvents": [
   212        {
   213          "client": "client0",
   214          "events": [
   215            {
   216              "commandStartedEvent": {
   217                "command": {
   218                  "update": "test",
   219                  "updates": [
   220                    {
   221                      "q": {},
   222                      "u": {
   223                        "$set": {
   224                          "y.$[i].b": 2
   225                        }
   226                      },
   227                      "multi": true,
   228                      "upsert": {
   229                        "$$unsetOrMatches": false
   230                      },
   231                      "arrayFilters": [
   232                        {
   233                          "i.b": 1
   234                        }
   235                      ]
   236                    }
   237                  ],
   238                  "ordered": true
   239                },
   240                "commandName": "update",
   241                "databaseName": "crud-tests"
   242              }
   243            }
   244          ]
   245        }
   246      ],
   247      "outcome": [
   248        {
   249          "collectionName": "test",
   250          "databaseName": "crud-tests",
   251          "documents": [
   252            {
   253              "_id": 1,
   254              "y": [
   255                {
   256                  "b": 3
   257                },
   258                {
   259                  "b": 2
   260                }
   261              ]
   262            },
   263            {
   264              "_id": 2,
   265              "y": [
   266                {
   267                  "b": 0
   268                },
   269                {
   270                  "b": 2
   271                }
   272              ]
   273            }
   274          ]
   275        }
   276      ]
   277    }
   278  ]
   279}

View as plain text