{ "description": "findOneAndUpdate-errorLabels", "schemaVersion": "1.3", "runOnRequirements": [ { "minServerVersion": "4.3.1", "topologies": [ "replicaset", "sharded", "load-balanced" ] } ], "createEntities": [ { "client": { "id": "client0", "useMultipleMongoses": false } }, { "database": { "id": "database0", "client": "client0", "databaseName": "retryable-writes-tests" } }, { "collection": { "id": "collection0", "database": "database0", "collectionName": "coll" } } ], "initialData": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 }, { "_id": 2, "x": 22 } ] } ], "tests": [ { "description": "FindOneAndUpdate succeeds with RetryableWriteError from server", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "findAndModify" ], "errorCode": 112, "errorLabels": [ "RetryableWriteError" ] } } } }, { "object": "collection0", "name": "findOneAndUpdate", "arguments": { "filter": { "_id": 1 }, "update": { "$inc": { "x": 1 } }, "returnDocument": "Before" }, "expectResult": { "_id": 1, "x": 11 } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 12 }, { "_id": 2, "x": 22 } ] } ] }, { "description": "FindOneAndUpdate fails if server does not return RetryableWriteError", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "findAndModify" ], "errorCode": 11600, "errorLabels": [] } } } }, { "object": "collection0", "name": "findOneAndUpdate", "arguments": { "filter": { "_id": 1 }, "update": { "$inc": { "x": 1 } }, "returnDocument": "Before" }, "expectError": { "isError": true, "errorLabelsOmit": [ "RetryableWriteError" ] } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 11 }, { "_id": 2, "x": 22 } ] } ] }, { "description": "FindOneAndUpdate succeeds after PrimarySteppedDown", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "findAndModify" ], "errorCode": 189, "errorLabels": [ "RetryableWriteError" ] } } } }, { "object": "collection0", "name": "findOneAndUpdate", "arguments": { "filter": { "_id": 1 }, "update": { "$inc": { "x": 1 } }, "returnDocument": "Before" }, "expectResult": { "_id": 1, "x": 11 } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 12 }, { "_id": 2, "x": 22 } ] } ] }, { "description": "FindOneAndUpdate succeeds after WriteConcernError ShutdownInProgress", "operations": [ { "name": "failPoint", "object": "testRunner", "arguments": { "client": "client0", "failPoint": { "configureFailPoint": "failCommand", "mode": { "times": 1 }, "data": { "failCommands": [ "findAndModify" ], "errorLabels": [ "RetryableWriteError" ], "writeConcernError": { "code": 91, "errmsg": "Replication is being shut down" } } } } }, { "object": "collection0", "name": "findOneAndUpdate", "arguments": { "filter": { "_id": 1 }, "update": { "$inc": { "x": 1 } }, "returnDocument": "Before" }, "expectResult": { "_id": 1, "x": 11 } } ], "outcome": [ { "collectionName": "coll", "databaseName": "retryable-writes-tests", "documents": [ { "_id": 1, "x": 12 }, { "_id": 2, "x": 22 } ] } ] } ] }