...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/v1/write/updateMany.json

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

     1{
     2  "data": [
     3    {
     4      "_id": 1,
     5      "x": 11
     6    },
     7    {
     8      "_id": 2,
     9      "x": 22
    10    },
    11    {
    12      "_id": 3,
    13      "x": 33
    14    }
    15  ],
    16  "minServerVersion": "2.6",
    17  "tests": [
    18    {
    19      "description": "UpdateMany when many documents match",
    20      "operation": {
    21        "name": "updateMany",
    22        "arguments": {
    23          "filter": {
    24            "_id": {
    25              "$gt": 1
    26            }
    27          },
    28          "update": {
    29            "$inc": {
    30              "x": 1
    31            }
    32          }
    33        }
    34      },
    35      "outcome": {
    36        "result": {
    37          "matchedCount": 2,
    38          "modifiedCount": 2,
    39          "upsertedCount": 0
    40        },
    41        "collection": {
    42          "data": [
    43            {
    44              "_id": 1,
    45              "x": 11
    46            },
    47            {
    48              "_id": 2,
    49              "x": 23
    50            },
    51            {
    52              "_id": 3,
    53              "x": 34
    54            }
    55          ]
    56        }
    57      }
    58    },
    59    {
    60      "description": "UpdateMany when one document matches",
    61      "operation": {
    62        "name": "updateMany",
    63        "arguments": {
    64          "filter": {
    65            "_id": 1
    66          },
    67          "update": {
    68            "$inc": {
    69              "x": 1
    70            }
    71          }
    72        }
    73      },
    74      "outcome": {
    75        "result": {
    76          "matchedCount": 1,
    77          "modifiedCount": 1,
    78          "upsertedCount": 0
    79        },
    80        "collection": {
    81          "data": [
    82            {
    83              "_id": 1,
    84              "x": 12
    85            },
    86            {
    87              "_id": 2,
    88              "x": 22
    89            },
    90            {
    91              "_id": 3,
    92              "x": 33
    93            }
    94          ]
    95        }
    96      }
    97    },
    98    {
    99      "description": "UpdateMany when no documents match",
   100      "operation": {
   101        "name": "updateMany",
   102        "arguments": {
   103          "filter": {
   104            "_id": 4
   105          },
   106          "update": {
   107            "$inc": {
   108              "x": 1
   109            }
   110          }
   111        }
   112      },
   113      "outcome": {
   114        "result": {
   115          "matchedCount": 0,
   116          "modifiedCount": 0,
   117          "upsertedCount": 0
   118        },
   119        "collection": {
   120          "data": [
   121            {
   122              "_id": 1,
   123              "x": 11
   124            },
   125            {
   126              "_id": 2,
   127              "x": 22
   128            },
   129            {
   130              "_id": 3,
   131              "x": 33
   132            }
   133          ]
   134        }
   135      }
   136    },
   137    {
   138      "description": "UpdateMany with upsert when no documents match",
   139      "operation": {
   140        "name": "updateMany",
   141        "arguments": {
   142          "filter": {
   143            "_id": 4
   144          },
   145          "update": {
   146            "$inc": {
   147              "x": 1
   148            }
   149          },
   150          "upsert": true
   151        }
   152      },
   153      "outcome": {
   154        "result": {
   155          "matchedCount": 0,
   156          "modifiedCount": 0,
   157          "upsertedCount": 1,
   158          "upsertedId": 4
   159        },
   160        "collection": {
   161          "data": [
   162            {
   163              "_id": 1,
   164              "x": 11
   165            },
   166            {
   167              "_id": 2,
   168              "x": 22
   169            },
   170            {
   171              "_id": 3,
   172              "x": 33
   173            },
   174            {
   175              "_id": 4,
   176              "x": 1
   177            }
   178          ]
   179        }
   180      }
   181    }
   182  ]
   183}

View as plain text