|
The causal consistency design document states that $clusterTime is included in all responses, even ones reporting an error, as in:
replset:SECONDARY> db.runCommand({find : "test", readConcern : {level : "local"} })
|
{
|
"operationTime" : Timestamp(1506613470, 1),
|
"ok" : 0,
|
"errmsg" : "not master and slaveOk=false",
|
"code" : 13435,
|
"codeName" : "NotMasterNoSlaveOk",
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1506613470, 1),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
}
|
}
|
At least one error condition violates the rule:
replset:SECONDARY> db.runCommand({find : "test", readConcern : {level : "majority"}, $readPreference : {mode : "secondary"} })
|
{
|
"ok" : 0,
|
"errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.",
|
"code" : 148,
|
"codeName" : "ReadConcernMajorityNotEnabled"
|
}
|
The expected behavior is that the response contains a $clusterTime.
|