...

Text file src/go.mongodb.org/mongo-driver/testdata/command-monitoring/updateMany.json

Documentation: go.mongodb.org/mongo-driver/testdata/command-monitoring

     1{
     2  "description": "updateMany",
     3  "schemaVersion": "1.0",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client",
     8        "observeEvents": [
     9          "commandStartedEvent",
    10          "commandSucceededEvent",
    11          "commandFailedEvent"
    12        ]
    13      }
    14    },
    15    {
    16      "database": {
    17        "id": "database",
    18        "client": "client",
    19        "databaseName": "command-monitoring-tests"
    20      }
    21    },
    22    {
    23      "collection": {
    24        "id": "collection",
    25        "database": "database",
    26        "collectionName": "test"
    27      }
    28    }
    29  ],
    30  "initialData": [
    31    {
    32      "collectionName": "test",
    33      "databaseName": "command-monitoring-tests",
    34      "documents": [
    35        {
    36          "_id": 1,
    37          "x": 11
    38        },
    39        {
    40          "_id": 2,
    41          "x": 22
    42        },
    43        {
    44          "_id": 3,
    45          "x": 33
    46        }
    47      ]
    48    }
    49  ],
    50  "tests": [
    51    {
    52      "description": "A successful updateMany",
    53      "operations": [
    54        {
    55          "name": "updateMany",
    56          "object": "collection",
    57          "arguments": {
    58            "filter": {
    59              "_id": {
    60                "$gt": 1
    61              }
    62            },
    63            "update": {
    64              "$inc": {
    65                "x": 1
    66              }
    67            }
    68          }
    69        }
    70      ],
    71      "expectEvents": [
    72        {
    73          "client": "client",
    74          "events": [
    75            {
    76              "commandStartedEvent": {
    77                "command": {
    78                  "update": "test",
    79                  "updates": [
    80                    {
    81                      "q": {
    82                        "_id": {
    83                          "$gt": 1
    84                        }
    85                      },
    86                      "u": {
    87                        "$inc": {
    88                          "x": 1
    89                        }
    90                      },
    91                      "upsert": {
    92                        "$$unsetOrMatches": false
    93                      },
    94                      "multi": true
    95                    }
    96                  ],
    97                  "ordered": true
    98                },
    99                "commandName": "update",
   100                "databaseName": "command-monitoring-tests"
   101              }
   102            },
   103            {
   104              "commandSucceededEvent": {
   105                "reply": {
   106                  "ok": 1,
   107                  "n": 2
   108                },
   109                "commandName": "update"
   110              }
   111            }
   112          ]
   113        }
   114      ]
   115    },
   116    {
   117      "description": "A successful updateMany with write errors",
   118      "operations": [
   119        {
   120          "name": "updateMany",
   121          "object": "collection",
   122          "arguments": {
   123            "filter": {
   124              "_id": {
   125                "$gt": 1
   126              }
   127            },
   128            "update": {
   129              "$unsupported": {
   130                "x": 1
   131              }
   132            }
   133          },
   134          "expectError": {
   135            "isClientError": false
   136          }
   137        }
   138      ],
   139      "expectEvents": [
   140        {
   141          "client": "client",
   142          "events": [
   143            {
   144              "commandStartedEvent": {
   145                "command": {
   146                  "update": "test",
   147                  "updates": [
   148                    {
   149                      "q": {
   150                        "_id": {
   151                          "$gt": 1
   152                        }
   153                      },
   154                      "u": {
   155                        "$unsupported": {
   156                          "x": 1
   157                        }
   158                      },
   159                      "upsert": {
   160                        "$$unsetOrMatches": false
   161                      },
   162                      "multi": true
   163                    }
   164                  ],
   165                  "ordered": true
   166                },
   167                "commandName": "update",
   168                "databaseName": "command-monitoring-tests"
   169              }
   170            },
   171            {
   172              "commandSucceededEvent": {
   173                "reply": {
   174                  "ok": 1,
   175                  "n": 0,
   176                  "writeErrors": {
   177                    "$$type": "array"
   178                  }
   179                },
   180                "commandName": "update"
   181              }
   182            }
   183          ]
   184        }
   185      ]
   186    }
   187  ]
   188}

View as plain text