...

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

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

     1data:
     2    - {_id: 1, x: 11}
     3    - {_id: 2, x: 22}
     4    - {_id: 3, x: 33}
     5
     6tests:
     7    -
     8        description: "DeleteOne when many documents match"
     9        operation:
    10            name: "deleteOne"
    11            arguments:
    12                filter: 
    13                    _id: {$gt: 1}
    14
    15        outcome:
    16            result:
    17                deletedCount: 1
    18            # can't verify collection because we don't have a way
    19            # of knowing which document gets deleted.
    20    -
    21        description: "DeleteOne when one document matches"
    22        operation:
    23            name: "deleteOne"
    24            arguments:
    25                filter: {_id: 2}
    26
    27        outcome:
    28            result:
    29                deletedCount: 1
    30            collection:
    31                data:
    32                    - {_id: 1, x: 11}
    33                    - {_id: 3, x: 33}
    34    -
    35        description: "DeleteOne when no documents match"
    36        operation:
    37            name: "deleteOne"
    38            arguments:
    39                filter: {_id: 4}
    40
    41        outcome:
    42            result:
    43                deletedCount: 0
    44            collection:
    45                data:
    46                    - {_id: 1, x: 11}
    47                    - {_id: 2, x: 22}
    48                    - {_id: 3, x: 33}

View as plain text