...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/aggregate-merge-errorResponse.yml

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

     1description: "aggregate-merge-errorResponse"
     2
     3schemaVersion: "1.12"
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     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 test
    16
    17initialData: &initialData
    18  - collectionName: *collection0Name
    19    databaseName: *database0Name
    20    documents:
    21      - { _id: 1, x: 1 }
    22      - { _id: 2, x: 1 }
    23
    24tests:
    25  - description: "aggregate $merge DuplicateKey error is accessible"
    26    runOnRequirements:
    27      - minServerVersion: "5.1" # SERVER-59097
    28        # Exclude sharded topologies since the aggregate command fails with
    29        # IllegalOperation(20) instead of DuplicateKey(11000)
    30        topologies: [ single, replicaset ]
    31    operations:
    32      - name: aggregate
    33        object: *database0
    34        arguments:
    35          pipeline:
    36            - { $documents: [ { _id: 2, x: 1 } ] }
    37            - { $merge: { into: *collection0Name, whenMatched: "fail" } }
    38        expectError:
    39          errorCode: 11000 # DuplicateKey
    40          errorResponse:
    41            keyPattern: { _id: 1 }
    42            keyValue: { _id: 2 }

View as plain text