...

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

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

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

View as plain text