Skip to content

mgo still not support writeConcern for findAndModify #176

Closed
@Mei-Zhao

Description

@Mei-Zhao

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"`

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions