...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/v1/write/insertMany.yml

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

     1data:
     2    - {_id: 1, x: 11}
     3
     4tests:
     5    -
     6        description: "InsertMany with non-existing documents"
     7        operation:
     8            name: "insertMany"
     9            arguments:
    10                documents: 
    11                    - {_id: 2, x: 22}
    12                    - {_id: 3, x: 33}
    13                options: { ordered: true }
    14        outcome:
    15            result:
    16                insertedIds: { 0: 2, 1: 3 }
    17            collection:
    18                data:
    19                    - {_id: 1, x: 11}
    20                    - {_id: 2, x: 22}
    21                    - {_id: 3, x: 33}
    22    -
    23        description: "InsertMany continue-on-error behavior with unordered (preexisting duplicate key)"
    24        operation:
    25            name: "insertMany"
    26            arguments:
    27                documents:
    28                    - { _id: 1, x: 11 }
    29                    - { _id: 2, x: 22 }
    30                    - { _id: 3, x: 33 }
    31                options: { ordered: false }
    32        outcome:
    33            error: true
    34            result:
    35                deletedCount: 0
    36                insertedCount: 2
    37                # Since the map of insertedIds is generated before execution it
    38                # could indicate inserts that did not actually succeed. We omit
    39                # this field rather than expect drivers to provide an accurate
    40                # map filtered by write errors.
    41                matchedCount: 0
    42                modifiedCount: 0
    43                upsertedCount: 0
    44                upsertedIds: { }
    45            collection:
    46                data:
    47                    - { _id: 1, x: 11 }
    48                    - { _id: 2, x: 22 }
    49                    - { _id: 3, x: 33 }
    50    -
    51        description: "InsertMany continue-on-error behavior with unordered (duplicate key in requests)"
    52        operation:
    53            name: "insertMany"
    54            arguments:
    55                documents:
    56                    - { _id: 2, x: 22 }
    57                    - { _id: 2, x: 22 }
    58                    - { _id: 3, x: 33 }
    59                options: { ordered: false }
    60        outcome:
    61            error: true
    62            result:
    63                deletedCount: 0
    64                insertedCount: 2
    65                # Since the map of insertedIds is generated before execution it
    66                # could indicate inserts that did not actually succeed. We omit
    67                # this field rather than expect drivers to provide an accurate
    68                # map filtered by write errors.
    69                matchedCount: 0
    70                modifiedCount: 0
    71                upsertedCount: 0
    72                upsertedIds: { }
    73            collection:
    74                data:
    75                    - { _id: 1, x: 11 }
    76                    - { _id: 2, x: 22 }
    77                    - { _id: 3, x: 33 }

View as plain text