...

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

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

     1{
     2  "description": "aggregate-merge-errorResponse",
     3  "schemaVersion": "1.12",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0"
     8      }
     9    },
    10    {
    11      "database": {
    12        "id": "database0",
    13        "client": "client0",
    14        "databaseName": "crud-tests"
    15      }
    16    },
    17    {
    18      "collection": {
    19        "id": "collection0",
    20        "database": "database0",
    21        "collectionName": "test"
    22      }
    23    }
    24  ],
    25  "initialData": [
    26    {
    27      "collectionName": "test",
    28      "databaseName": "crud-tests",
    29      "documents": [
    30        {
    31          "_id": 1,
    32          "x": 1
    33        },
    34        {
    35          "_id": 2,
    36          "x": 1
    37        }
    38      ]
    39    }
    40  ],
    41  "tests": [
    42    {
    43      "description": "aggregate $merge DuplicateKey error is accessible",
    44      "runOnRequirements": [
    45        {
    46          "minServerVersion": "5.1",
    47          "topologies": [
    48            "single",
    49            "replicaset"
    50          ]
    51        }
    52      ],
    53      "operations": [
    54        {
    55          "name": "aggregate",
    56          "object": "database0",
    57          "arguments": {
    58            "pipeline": [
    59              {
    60                "$documents": [
    61                  {
    62                    "_id": 2,
    63                    "x": 1
    64                  }
    65                ]
    66              },
    67              {
    68                "$merge": {
    69                  "into": "test",
    70                  "whenMatched": "fail"
    71                }
    72              }
    73            ]
    74          },
    75          "expectError": {
    76            "errorCode": 11000,
    77            "errorResponse": {
    78              "keyPattern": {
    79                "_id": 1
    80              },
    81              "keyValue": {
    82                "_id": 2
    83              }
    84            }
    85          }
    86        }
    87      ]
    88    }
    89  ]
    90}

View as plain text