...

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

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

     1{
     2  "description": "findOneAndUpdate-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": "foo"
    33        }
    34      ]
    35    }
    36  ],
    37  "tests": [
    38    {
    39      "description": "findOneAndUpdate DuplicateKey error is accessible",
    40      "runOnRequirements": [
    41        {
    42          "minServerVersion": "4.2"
    43        }
    44      ],
    45      "operations": [
    46        {
    47          "name": "createIndex",
    48          "object": "collection0",
    49          "arguments": {
    50            "keys": {
    51              "x": 1
    52            },
    53            "unique": true
    54          }
    55        },
    56        {
    57          "name": "findOneAndUpdate",
    58          "object": "collection0",
    59          "arguments": {
    60            "filter": {
    61              "_id": 2
    62            },
    63            "update": {
    64              "$set": {
    65                "x": "foo"
    66              }
    67            },
    68            "upsert": true
    69          },
    70          "expectError": {
    71            "errorCode": 11000,
    72            "errorResponse": {
    73              "keyPattern": {
    74                "x": 1
    75              },
    76              "keyValue": {
    77                "x": "foo"
    78              }
    79            }
    80          }
    81        }
    82      ]
    83    },
    84    {
    85      "description": "findOneAndUpdate document validation errInfo is accessible",
    86      "runOnRequirements": [
    87        {
    88          "minServerVersion": "5.0"
    89        }
    90      ],
    91      "operations": [
    92        {
    93          "name": "modifyCollection",
    94          "object": "database0",
    95          "arguments": {
    96            "collection": "test",
    97            "validator": {
    98              "x": {
    99                "$type": "string"
   100              }
   101            }
   102          }
   103        },
   104        {
   105          "name": "findOneAndUpdate",
   106          "object": "collection0",
   107          "arguments": {
   108            "filter": {
   109              "_id": 1
   110            },
   111            "update": {
   112              "$set": {
   113                "x": 1
   114              }
   115            }
   116          },
   117          "expectError": {
   118            "errorCode": 121,
   119            "errorResponse": {
   120              "errInfo": {
   121                "failingDocumentId": 1,
   122                "details": {
   123                  "$$type": "object"
   124                }
   125              }
   126            }
   127          }
   128        }
   129      ]
   130    }
   131  ]
   132}

View as plain text