...

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

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

     1description: "bulkWrite-update-validation"
     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: &initialData
    19  - collectionName: *collection0Name
    20    databaseName: *database0Name
    21    documents:
    22      - { _id: 1, x: 11 }
    23      - { _id: 2, x: 22 }
    24      - { _id: 3, x: 33 }
    25
    26tests:
    27  - description: "BulkWrite replaceOne prohibits atomic modifiers"
    28    operations:
    29      - name: bulkWrite
    30        object: *collection0
    31        arguments:
    32          requests:
    33            - replaceOne:
    34                filter: { _id: 1 }
    35                replacement: { $set: { x: 22 } }
    36        expectError:
    37          isClientError: true
    38    expectEvents:
    39      - client: *client0
    40        events: []
    41    outcome: *initialData
    42
    43  - description: "BulkWrite updateOne requires atomic modifiers"
    44    operations:
    45      - name: bulkWrite
    46        object: *collection0
    47        arguments:
    48          requests:
    49            - updateOne:
    50                filter: { _id: 1 }
    51                update: { x: 22 }
    52        expectError:
    53          isClientError: true
    54    expectEvents:
    55      - client: *client0
    56        events: []
    57    outcome: *initialData
    58
    59  - description: "BulkWrite updateMany requires atomic modifiers"
    60    operations:
    61      - name: bulkWrite
    62        object: *collection0
    63        arguments:
    64          requests:
    65            - updateMany:
    66                filter: { _id: { $gt: 1 } }
    67                update: { x: 44 }
    68        expectError:
    69          isClientError: true
    70    expectEvents:
    71      - client: *client0
    72        events: []
    73    outcome: *initialData

View as plain text