...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/findOneAndUpdate-comment.yml

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

     1description: "findOneAndUpdate-comment"
     2schemaVersion: "1.0"
     3
     4createEntities:
     5  - client:
     6      id: &client0 client0
     7      observeEvents: [ commandStartedEvent ]
     8  - database:
     9      id: &database0 database0
    10      client: *client0
    11      databaseName: &database0Name crud-tests
    12  - collection:
    13      id: &collection0 collection0
    14      database: *database0
    15      collectionName: &collection0Name coll0
    16
    17initialData: &initialData
    18  - collectionName: *collection0Name
    19    databaseName: *database0Name
    20    documents:
    21      - { _id: 1 }
    22      - { _id: 2 }
    23
    24tests:
    25  - description: "findOneAndUpdate with string comment"
    26    runOnRequirements:
    27      - minServerVersion: "4.4"
    28    operations:
    29      - name: findOneAndUpdate
    30        object: *collection0
    31        arguments:
    32          filter: &filter
    33            _id: 1
    34          update: &update
    35            - $set: {x: 5 }
    36          comment: "comment"
    37        expectResult:
    38          _id: 1
    39    expectEvents:
    40      - client: *client0
    41        events:
    42          - commandStartedEvent:
    43              command:
    44                findAndModify: *collection0Name
    45                query: *filter
    46                update: *update
    47                comment: "comment"
    48
    49  - description: "findOneAndUpdate with document comment"
    50    runOnRequirements:
    51      - minServerVersion: "4.4"
    52    operations:
    53      - name: findOneAndUpdate
    54        object: *collection0
    55        arguments:
    56          filter: &filter
    57            _id: 1
    58          update: &update
    59            - $set: {x: 5 }
    60          comment: &comment { key: "value"}
    61        expectResult:
    62          _id: 1
    63    expectEvents:
    64      - client: *client0
    65        events:
    66          - commandStartedEvent:
    67              command:
    68                findAndModify: *collection0Name
    69                query: *filter
    70                update: *update
    71                comment: *comment
    72
    73  - description: "findOneAndUpdate with comment - pre 4.4"
    74    runOnRequirements:
    75      - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2
    76        maxServerVersion: "4.2.99"
    77    operations:
    78      - name: findOneAndUpdate
    79        object: *collection0
    80        arguments:
    81          filter: *filter
    82          update: *update
    83          comment: "comment"
    84        expectError:
    85          isClientError: false
    86    expectEvents:
    87      - client: *client0
    88        events:
    89          - commandStartedEvent:
    90              command:
    91                findAndModify: *collection0Name
    92                query: *filter
    93                update: *update
    94                comment: "comment"
    95    outcome: *initialData

View as plain text