...

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

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

     1{
     2  "description": "updateMany-hint",
     3  "schemaVersion": "1.0",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "4.2.0"
     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-v2"
    23      }
    24    },
    25    {
    26      "collection": {
    27        "id": "collection0",
    28        "database": "database0",
    29        "collectionName": "test_updatemany_hint"
    30      }
    31    }
    32  ],
    33  "initialData": [
    34    {
    35      "collectionName": "test_updatemany_hint",
    36      "databaseName": "crud-v2",
    37      "documents": [
    38        {
    39          "_id": 1,
    40          "x": 11
    41        },
    42        {
    43          "_id": 2,
    44          "x": 22
    45        },
    46        {
    47          "_id": 3,
    48          "x": 33
    49        }
    50      ]
    51    }
    52  ],
    53  "tests": [
    54    {
    55      "description": "UpdateMany with hint string",
    56      "operations": [
    57        {
    58          "object": "collection0",
    59          "name": "updateMany",
    60          "arguments": {
    61            "filter": {
    62              "_id": {
    63                "$gt": 1
    64              }
    65            },
    66            "update": {
    67              "$inc": {
    68                "x": 1
    69              }
    70            },
    71            "hint": "_id_"
    72          },
    73          "expectResult": {
    74            "matchedCount": 2,
    75            "modifiedCount": 2,
    76            "upsertedCount": 0
    77          }
    78        }
    79      ],
    80      "expectEvents": [
    81        {
    82          "client": "client0",
    83          "events": [
    84            {
    85              "commandStartedEvent": {
    86                "command": {
    87                  "update": "test_updatemany_hint",
    88                  "updates": [
    89                    {
    90                      "q": {
    91                        "_id": {
    92                          "$gt": 1
    93                        }
    94                      },
    95                      "u": {
    96                        "$inc": {
    97                          "x": 1
    98                        }
    99                      },
   100                      "multi": true,
   101                      "hint": "_id_",
   102                      "upsert": {
   103                        "$$unsetOrMatches": false
   104                      }
   105                    }
   106                  ]
   107                }
   108              }
   109            }
   110          ]
   111        }
   112      ],
   113      "outcome": [
   114        {
   115          "collectionName": "test_updatemany_hint",
   116          "databaseName": "crud-v2",
   117          "documents": [
   118            {
   119              "_id": 1,
   120              "x": 11
   121            },
   122            {
   123              "_id": 2,
   124              "x": 23
   125            },
   126            {
   127              "_id": 3,
   128              "x": 34
   129            }
   130          ]
   131        }
   132      ]
   133    },
   134    {
   135      "description": "UpdateMany with hint document",
   136      "operations": [
   137        {
   138          "object": "collection0",
   139          "name": "updateMany",
   140          "arguments": {
   141            "filter": {
   142              "_id": {
   143                "$gt": 1
   144              }
   145            },
   146            "update": {
   147              "$inc": {
   148                "x": 1
   149              }
   150            },
   151            "hint": {
   152              "_id": 1
   153            }
   154          },
   155          "expectResult": {
   156            "matchedCount": 2,
   157            "modifiedCount": 2,
   158            "upsertedCount": 0
   159          }
   160        }
   161      ],
   162      "expectEvents": [
   163        {
   164          "client": "client0",
   165          "events": [
   166            {
   167              "commandStartedEvent": {
   168                "command": {
   169                  "update": "test_updatemany_hint",
   170                  "updates": [
   171                    {
   172                      "q": {
   173                        "_id": {
   174                          "$gt": 1
   175                        }
   176                      },
   177                      "u": {
   178                        "$inc": {
   179                          "x": 1
   180                        }
   181                      },
   182                      "multi": true,
   183                      "hint": {
   184                        "_id": 1
   185                      },
   186                      "upsert": {
   187                        "$$unsetOrMatches": false
   188                      }
   189                    }
   190                  ]
   191                }
   192              }
   193            }
   194          ]
   195        }
   196      ],
   197      "outcome": [
   198        {
   199          "collectionName": "test_updatemany_hint",
   200          "databaseName": "crud-v2",
   201          "documents": [
   202            {
   203              "_id": 1,
   204              "x": 11
   205            },
   206            {
   207              "_id": 2,
   208              "x": 23
   209            },
   210            {
   211              "_id": 3,
   212              "x": 34
   213            }
   214          ]
   215        }
   216      ]
   217    }
   218  ]
   219}

View as plain text