...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-writes/legacy/findOneAndUpdate-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": "FindOneAndUpdate 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": "findOneAndUpdate",
    47        "arguments": {
    48          "filter": {
    49            "_id": 1
    50          },
    51          "update": {
    52            "$inc": {
    53              "x": 1
    54            }
    55          },
    56          "returnDocument": "Before"
    57        }
    58      },
    59      "outcome": {
    60        "result": {
    61          "_id": 1,
    62          "x": 11
    63        },
    64        "collection": {
    65          "data": [
    66            {
    67              "_id": 1,
    68              "x": 12
    69            },
    70            {
    71              "_id": 2,
    72              "x": 22
    73            }
    74          ]
    75        }
    76      }
    77    },
    78    {
    79      "description": "FindOneAndUpdate succeeds after WriteConcernError ShutdownInProgress",
    80      "failPoint": {
    81        "configureFailPoint": "failCommand",
    82        "mode": {
    83          "times": 1
    84        },
    85        "data": {
    86          "failCommands": [
    87            "findAndModify"
    88          ],
    89          "writeConcernError": {
    90            "code": 91,
    91            "errmsg": "Replication is being shut down",
    92            "errorLabels": [
    93              "RetryableWriteError"
    94            ]
    95          }
    96        }
    97      },
    98      "operation": {
    99        "name": "findOneAndUpdate",
   100        "arguments": {
   101          "filter": {
   102            "_id": 1
   103          },
   104          "update": {
   105            "$inc": {
   106              "x": 1
   107            }
   108          },
   109          "returnDocument": "Before"
   110        }
   111      },
   112      "outcome": {
   113        "result": {
   114          "_id": 1,
   115          "x": 11
   116        },
   117        "collection": {
   118          "data": [
   119            {
   120              "_id": 1,
   121              "x": 12
   122            },
   123            {
   124              "_id": 2,
   125              "x": 22
   126            }
   127          ]
   128        }
   129      }
   130    },
   131    {
   132      "description": "FindOneAndUpdate fails with a RetryableWriteError label after two connection failures",
   133      "failPoint": {
   134        "configureFailPoint": "failCommand",
   135        "mode": {
   136          "times": 2
   137        },
   138        "data": {
   139          "failCommands": [
   140            "findAndModify"
   141          ],
   142          "closeConnection": true
   143        }
   144      },
   145      "operation": {
   146        "name": "findOneAndUpdate",
   147        "arguments": {
   148          "filter": {
   149            "_id": 1
   150          },
   151          "update": {
   152            "$inc": {
   153              "x": 1
   154            }
   155          },
   156          "returnDocument": "Before"
   157        }
   158      },
   159      "outcome": {
   160        "error": true,
   161        "result": {
   162          "errorLabelsContain": [
   163            "RetryableWriteError"
   164          ]
   165        },
   166        "collection": {
   167          "data": [
   168            {
   169              "_id": 1,
   170              "x": 11
   171            },
   172            {
   173              "_id": 2,
   174              "x": 22
   175            }
   176          ]
   177        }
   178      }
   179    }
   180  ]
   181}

View as plain text