Closed Mei-Zhao closed 6 years ago
mongod has support writeConcern for findAndModify command since v3.2
https://docs.mongodb.com/v3.4/reference/command/findAndModify/#dbcmd.findAndModify(the Output part still not update)
If the cluster has been set with getLastErrorDefaults like:
` "getLastErrorDefaults" : {
"w" : "majority", "wtimeout" : 5000
} `
The cluster has 5 nodes and 3 of them have been locked by fsyncLock(). The test result returned from Mongod (v3.4) about a findAndModify command like
findAndModify: { "lastErrorObject" : { "n" : 1, "updatedExisting" : true }, "ok" : 1, "writeConcernError" : { "code" : 64, "errInfo" : { "wtimeout" : true }, "errmsg" : "waiting for replication timed out", "codeName" : "WriteConcernFailed" }, "value" : { "fid" : 367585860, "_id" : "5afbf542588399814fe36b5a" } }
The findAndModify result define in mgo seesion.go did not deal with writeConcernErr,in detail:
` type valueResult struct {
Value bson.Raw LastError LastError `bson:"lastErrorObject"`
}`
Hi @Mei-Zhao
This mgo fork is a community project - we'll happily accept a PR for findAndModify!
findAndModify
Dom
mongod has support writeConcern for findAndModify command since v3.2
https://docs.mongodb.com/v3.4/reference/command/findAndModify/#dbcmd.findAndModify(the Output part still not update)
If the cluster has been set with getLastErrorDefaults like:
` "getLastErrorDefaults" : {
} `
The cluster has 5 nodes and 3 of them have been locked by fsyncLock(). The test result returned from Mongod (v3.4) about a findAndModify command like
findAndModify: { "lastErrorObject" : { "n" : 1, "updatedExisting" : true }, "ok" : 1, "writeConcernError" : { "code" : 64, "errInfo" : { "wtimeout" : true }, "errmsg" : "waiting for replication timed out", "codeName" : "WriteConcernFailed" }, "value" : { "fid" : 367585860, "_id" : "5afbf542588399814fe36b5a" } }
The findAndModify result define in mgo seesion.go did not deal with writeConcernErr,in detail:
` type valueResult struct {
}`