...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/bulkWrite-update-hint.yml

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

     1# This file was created automatically using mongodb-spec-converter.
     2# Please review the generated file, then remove this notice.
     3
     4description: bulkWrite-update-hint
     5schemaVersion: '1.0'
     6runOnRequirements:
     7  -
     8    minServerVersion: 4.2.0
     9createEntities:
    10  -
    11    client:
    12      id: &client0 client0
    13      observeEvents:
    14        - commandStartedEvent
    15  -
    16    database:
    17      id: &database0 database0
    18      client: client0
    19      databaseName: &database_name crud-v2
    20  -
    21    collection:
    22      id: &collection0 collection0
    23      database: database0
    24      collectionName: &collection_name test_bulkwrite_update_hint
    25initialData:
    26  -
    27    collectionName: *collection_name
    28    databaseName: *database_name
    29    documents:
    30      -
    31        _id: 1
    32        x: 11
    33      -
    34        _id: 2
    35        x: 22
    36      -
    37        _id: 3
    38        x: 33
    39      -
    40        _id: 4
    41        x: 44
    42tests:
    43  -
    44    description: 'BulkWrite updateOne with update hints'
    45    operations:
    46      -
    47        object: *collection0
    48        name: bulkWrite
    49        arguments:
    50          requests:
    51            -
    52              updateOne:
    53                filter: &updateOne_filter
    54                  _id: 1
    55                update: &updateOne_update
    56                  $inc:
    57                    x: 1
    58                hint: &hint_string _id_
    59            -
    60              updateOne:
    61                filter: *updateOne_filter
    62                update: *updateOne_update
    63                hint: &hint_doc
    64                  _id: 1
    65          ordered: true
    66        expectResult:
    67          deletedCount: 0
    68          insertedCount: 0
    69          insertedIds: { $$unsetOrMatches: {} }
    70          matchedCount: 2
    71          modifiedCount: 2
    72          upsertedCount: 0
    73          upsertedIds: {  }
    74    expectEvents:
    75      -
    76        client: *client0
    77        events:
    78          -
    79            commandStartedEvent:
    80              command:
    81                update: *collection_name
    82                updates:
    83                  -
    84                    q: *updateOne_filter
    85                    u: *updateOne_update
    86                    multi: { $$unsetOrMatches: false }
    87                    upsert: { $$unsetOrMatches: false }
    88                    hint: *hint_string
    89                  -
    90                    q: *updateOne_filter
    91                    u: *updateOne_update
    92                    multi: { $$unsetOrMatches: false }
    93                    upsert: { $$unsetOrMatches: false }
    94                    hint: *hint_doc
    95                ordered: true
    96    outcome:
    97      -
    98        collectionName: *collection_name
    99        databaseName: *database_name
   100        documents:
   101          -
   102            _id: 1
   103            x: 13
   104          -
   105            _id: 2
   106            x: 22
   107          -
   108            _id: 3
   109            x: 33
   110          -
   111            _id: 4
   112            x: 44
   113  -
   114    description: 'BulkWrite updateMany with update hints'
   115    operations:
   116      -
   117        object: *collection0
   118        name: bulkWrite
   119        arguments:
   120          requests:
   121            -
   122              updateMany:
   123                filter: &updateMany_filter
   124                  _id:
   125                    $lt: 3
   126                update: &updateMany_update
   127                  $inc:
   128                    x: 1
   129                hint: *hint_string
   130            -
   131              updateMany:
   132                filter: *updateMany_filter
   133                update: *updateMany_update
   134                hint: *hint_doc
   135          ordered: true
   136        expectResult:
   137          deletedCount: 0
   138          insertedCount: 0
   139          insertedIds: { $$unsetOrMatches: {} }
   140          matchedCount: 4
   141          modifiedCount: 4
   142          upsertedCount: 0
   143          upsertedIds: {  }
   144    expectEvents:
   145      -
   146        client: *client0
   147        events:
   148          -
   149            commandStartedEvent:
   150              command:
   151                update: *collection_name
   152                updates:
   153                  -
   154                    q: *updateMany_filter
   155                    u: *updateMany_update
   156                    multi: true
   157                    upsert: { $$unsetOrMatches: false }
   158                    hint: *hint_string
   159                  -
   160                    q: *updateMany_filter
   161                    u: *updateMany_update
   162                    multi: true
   163                    upsert: { $$unsetOrMatches: false }
   164                    hint: *hint_doc
   165                ordered: true
   166    outcome:
   167      -
   168        collectionName: *collection_name
   169        databaseName: *database_name
   170        documents:
   171          -
   172            _id: 1
   173            x: 13
   174          -
   175            _id: 2
   176            x: 24
   177          -
   178            _id: 3
   179            x: 33
   180          -
   181            _id: 4
   182            x: 44
   183  -
   184    description: 'BulkWrite replaceOne with update hints'
   185    operations:
   186      -
   187        object: *collection0
   188        name: bulkWrite
   189        arguments:
   190          requests:
   191            -
   192              replaceOne:
   193                filter:
   194                  _id: 3
   195                replacement:
   196                  x: 333
   197                hint: *hint_string
   198            -
   199              replaceOne:
   200                filter:
   201                  _id: 4
   202                replacement:
   203                  x: 444
   204                hint: *hint_doc
   205          ordered: true
   206        expectResult:
   207          deletedCount: 0
   208          insertedCount: 0
   209          insertedIds: { $$unsetOrMatches: {} }
   210          matchedCount: 2
   211          modifiedCount: 2
   212          upsertedCount: 0
   213          upsertedIds: {  }
   214    expectEvents:
   215      -
   216        client: *client0
   217        events:
   218          -
   219            commandStartedEvent:
   220              command:
   221                update: *collection_name
   222                updates:
   223                  -
   224                    q:
   225                      _id: 3
   226                    u:
   227                      x: 333
   228                    multi: { $$unsetOrMatches: false }
   229                    upsert: { $$unsetOrMatches: false }
   230                    hint: *hint_string
   231                  -
   232                    q:
   233                      _id: 4
   234                    u:
   235                      x: 444
   236                    multi: { $$unsetOrMatches: false }
   237                    upsert: { $$unsetOrMatches: false }
   238                    hint: *hint_doc
   239                ordered: true
   240    outcome:
   241      -
   242        collectionName: *collection_name
   243        databaseName: *database_name
   244        documents:
   245          -
   246            _id: 1
   247            x: 11
   248          -
   249            _id: 2
   250            x: 22
   251          -
   252            _id: 3
   253            x: 333
   254          -
   255            _id: 4
   256            x: 444

View as plain text