...

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

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

     1description: "insertOne-comment"
     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
    24tests:
    25  - description: "insertOne with string comment"
    26    runOnRequirements:
    27      - minServerVersion: "4.4"
    28    operations:
    29      - name: insertOne
    30        object: *collection0
    31        arguments:
    32          document: &document { _id: 2, x: 22 }
    33          comment: "comment"
    34    expectEvents:
    35      - client: *client0
    36        events:
    37          - commandStartedEvent:
    38              command:
    39                insert: *collection0Name
    40                documents:
    41                  - *document
    42                comment: "comment"
    43    outcome: &outcome
    44      - collectionName: *collection0Name
    45        databaseName: *database0Name
    46        documents:
    47          - { _id: 1, x: 11 }
    48          - { _id: 2, x: 22 }
    49
    50  - description: "insertOne with document comment"
    51    runOnRequirements:
    52      - minServerVersion: "3.4.0"
    53      - minServerVersion: "4.4"
    54    operations:
    55      - name: insertOne
    56        object: *collection0
    57        arguments:
    58          document: *document
    59          comment: &comment { key: "value" }
    60    expectEvents:
    61      - client: *client0
    62        events:
    63          - commandStartedEvent:
    64              command:
    65                insert: *collection0Name
    66                documents:
    67                  - *document
    68                comment: *comment
    69    outcome: *outcome
    70
    71  - description: "insertOne with comment - pre 4.4"
    72    runOnRequirements:
    73      - minServerVersion: "3.4.0"
    74        maxServerVersion: "4.2.99"
    75    operations:
    76      - name: insertOne
    77        object: *collection0
    78        arguments:
    79          document: *document
    80          comment: "comment"
    81        expectError:
    82          isClientError: false
    83    expectEvents:
    84      - client: *client0
    85        events:
    86          - commandStartedEvent:
    87              command:
    88                insert: *collection0Name
    89                documents:
    90                  - *document
    91                comment: "comment"
    92    outcome: *initialData

View as plain text