...

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

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

     1description: "BulkWrite updateMany-let"
     2
     3schemaVersion: "1.0"
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      observeEvents: [ commandStartedEvent ]
     9  - database:
    10      id: &database0 database0
    11      client: *client0
    12      databaseName: &database0Name crud-tests
    13  - collection:
    14      id: &collection0 collection0
    15      database: *database0
    16      collectionName: &collection0Name coll0
    17
    18initialData:
    19  - collectionName: *collection0Name
    20    databaseName: *database0Name
    21    documents:
    22      - { _id: 1, x: 20 }
    23      - { _id: 2, x: 21 }
    24
    25tests:
    26  - description: "BulkWrite updateMany with let option"
    27    runOnRequirements:
    28      - minServerVersion: "5.0"
    29    operations:
    30      - object: *collection0
    31        name: bulkWrite
    32        arguments:
    33          requests:
    34            - updateMany:
    35                filter: &filter
    36                  $expr:
    37                    $eq: [ "$_id", "$$id" ]
    38                update: &update
    39                  - $set:
    40                      x: 21
    41          let: &let
    42            id: 1
    43    expectEvents:
    44      - client: *client0
    45        events:
    46          - commandStartedEvent:
    47              command:
    48                update: *collection0Name
    49                updates:
    50                  - q: *filter
    51                    u: *update
    52                    multi: true
    53                    upsert: { $$unsetOrMatches: false }
    54                let: *let
    55    outcome:
    56      - collectionName: *collection0Name
    57        databaseName: *database0Name
    58        documents:
    59          - { _id: 1, x: 21 }
    60          - { _id: 2, x: 21 }
    61
    62  - description: "BulkWrite updateMany with let option unsupported (server-side error)"
    63    runOnRequirements:
    64      - minServerVersion: "4.2.0"
    65        maxServerVersion: "4.9"
    66    operations:
    67      - object: *collection0
    68        name: bulkWrite
    69        arguments:
    70          requests:
    71            - updateMany:
    72                filter: *filter
    73                update: *update
    74          let: *let
    75        expectError:
    76          errorContains: "'update.let' is an unknown field"
    77          isClientError: false
    78    expectEvents:
    79      - client: *client0
    80        events:
    81          - commandStartedEvent:
    82              command:
    83                update: *collection0Name
    84                updates:
    85                  - q: *filter
    86                    u: *update
    87                    multi: true
    88                    upsert: { $$unsetOrMatches: false }
    89                let: *let
    90
    91    outcome:
    92      - collectionName: *collection0Name
    93        databaseName: *database0Name
    94        documents:
    95          - { _id: 1, x: 20 }
    96          - { _id: 2, x: 21 }

View as plain text