...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/findOneAndReplace-serverErrors.json

Documentation: go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy

     1{
     2  "runOn": [
     3    {
     4      "minServerVersion": "4.0",
     5      "topology": [
     6        "replicaset"
     7      ]
     8    },
     9    {
    10      "minServerVersion": "4.1.7",
    11      "topology": [
    12        "sharded",
    13        "load-balanced"
    14      ]
    15    }
    16  ],
    17  "data": [
    18    {
    19      "_id": 1,
    20      "x": 11
    21    },
    22    {
    23      "_id": 2,
    24      "x": 22
    25    }
    26  ],
    27  "tests": [
    28    {
    29      "description": "FindOneAndReplace succeeds after PrimarySteppedDown",
    30      "failPoint": {
    31        "configureFailPoint": "failCommand",
    32        "mode": {
    33          "times": 1
    34        },
    35        "data": {
    36          "failCommands": [
    37            "findAndModify"
    38          ],
    39          "errorCode": 189,
    40          "errorLabels": [
    41            "RetryableWriteError"
    42          ]
    43        }
    44      },
    45      "operation": {
    46        "name": "findOneAndReplace",
    47        "arguments": {
    48          "filter": {
    49            "_id": 1
    50          },
    51          "replacement": {
    52            "_id": 1,
    53            "x": 111
    54          },
    55          "returnDocument": "Before"
    56        }
    57      },
    58      "outcome": {
    59        "result": {
    60          "_id": 1,
    61          "x": 11
    62        },
    63        "collection": {
    64          "data": [
    65            {
    66              "_id": 1,
    67              "x": 111
    68            },
    69            {
    70              "_id": 2,
    71              "x": 22
    72            }
    73          ]
    74        }
    75      }
    76    },
    77    {
    78      "description": "FindOneAndReplace succeeds after WriteConcernError ShutdownInProgress",
    79      "failPoint": {
    80        "configureFailPoint": "failCommand",
    81        "mode": {
    82          "times": 1
    83        },
    84        "data": {
    85          "failCommands": [
    86            "findAndModify"
    87          ],
    88          "writeConcernError": {
    89            "code": 91,
    90            "errmsg": "Replication is being shut down",
    91            "errorLabels": [
    92              "RetryableWriteError"
    93            ]
    94          }
    95        }
    96      },
    97      "operation": {
    98        "name": "findOneAndReplace",
    99        "arguments": {
   100          "filter": {
   101            "_id": 1
   102          },
   103          "replacement": {
   104            "_id": 1,
   105            "x": 111
   106          },
   107          "returnDocument": "Before"
   108        }
   109      },
   110      "outcome": {
   111        "result": {
   112          "_id": 1,
   113          "x": 11
   114        },
   115        "collection": {
   116          "data": [
   117            {
   118              "_id": 1,
   119              "x": 111
   120            },
   121            {
   122              "_id": 2,
   123              "x": 22
   124            }
   125          ]
   126        }
   127      }
   128    },
   129    {
   130      "description": "FindOneAndReplace fails with a RetryableWriteError label after two connection failures",
   131      "failPoint": {
   132        "configureFailPoint": "failCommand",
   133        "mode": {
   134          "times": 2
   135        },
   136        "data": {
   137          "failCommands": [
   138            "findAndModify"
   139          ],
   140          "closeConnection": true
   141        }
   142      },
   143      "operation": {
   144        "name": "findOneAndReplace",
   145        "arguments": {
   146          "filter": {
   147            "_id": 1
   148          },
   149          "replacement": {
   150            "_id": 1,
   151            "x": 111
   152          },
   153          "returnDocument": "Before"
   154        }
   155      },
   156      "outcome": {
   157        "error": true,
   158        "result": {
   159          "errorLabelsContain": [
   160            "RetryableWriteError"
   161          ]
   162        },
   163        "collection": {
   164          "data": [
   165            {
   166              "_id": 1,
   167              "x": 11
   168            },
   169            {
   170              "_id": 2,
   171              "x": 22
   172            }
   173          ]
   174        }
   175      }
   176    }
   177  ]
   178}

View as plain text