summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/commands/create_indexes.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index b534acba487..adb56fa19e2 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -274,14 +274,18 @@ Status validateTTLOptions(OperationContext* opCtx, const BSONObj& cmdObj) {
*/
boost::optional<CommitQuorumOptions> parseAndGetCommitQuorum(OperationContext* opCtx,
const BSONObj& cmdObj) {
+ auto replCoord = repl::ReplicationCoordinator::get(opCtx);
+
if (cmdObj.hasField(kCommitQuorumFieldName)) {
+ uassert(ErrorCodes::BadValue,
+ str::stream() << "Standalones can't specify commitQuorum",
+ replCoord->isReplEnabled());
CommitQuorumOptions commitQuorum;
uassertStatusOK(commitQuorum.parse(cmdObj.getField(kCommitQuorumFieldName)));
return commitQuorum;
} else {
// Retrieve the default commit quorum if one wasn't passed in, which consists of all
// data-bearing nodes.
- auto replCoord = repl::ReplicationCoordinator::get(opCtx);
int numDataBearingMembers =
replCoord->isReplEnabled() ? replCoord->getConfig().getNumDataBearingMembers() : 1;
return CommitQuorumOptions(numDataBearingMembers);