|
Majority writes, which succeed doing the local write, but fail to wait for write concern will return 'ok: 1', but will contain a writeConcern section:
testReplSet:PRIMARY> db.runCommand({ insert: 'TestColl', documents: [ { Key: 3, Value: 'Value 3' } ], writeConcern: { w: 'majority', wtimeout: 2000 } });
|
{
|
"ok" : 1,
|
"n" : 1,
|
"opTime" : {
|
"ts" : Timestamp(1455914253, 1),
|
"t" : NumberLong(4)
|
},
|
"electionId" : ObjectId("7fffffff0000000000000004"),
|
"writeConcernError" : {
|
"code" : 64,
|
"errInfo" : {
|
"wtimeout" : true
|
},
|
"errmsg" : "waiting for replication timed out"
|
}
|
}
|
The sharding registry write commands should check for write concern failure and retry if necessary.
|