...

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

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

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

View as plain text