-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.0-rc2
-
Component/s: Sharding
-
None
-
Sharding
mongos> db.test.runCommand({count: "test", query: {}, readConcern: {level: "majority"}}) { "shards" : { }, "cause" : { "ok" : 0, "errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.", "code" : 148 }, "code" : 148, "ok" : 0, "errmsg" : "failed on : sh01" }
Same applies to aggregate and I imagine the others
mongos> db.test.runCommand({count: "aggregate", pipeline: {}, readConcern: {level: "majority"}}) { "shards" : { }, "cause" : { "ok" : 0, "errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.", "code" : 148 }, "code" : 148, "ok" : 0, "errmsg" : "failed on : sh01" }
Most/all drivers only expose the "errmsg", which results in the cryptic "failed on: sh01" error message being all the users see.
The cause.errmsg should probably overwrite the top-level errmsg similarly to how find does it:
mongos> db.test.runCommand({find: "test", filter: {}, readConcern: {level: "majority"}}) { "ok" : 0, "errmsg" : "Majority read concern requested, but server was not started with --enableMajorityReadConcern.", "code" : 148 }