summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/s/shardsvr_shard_collection.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/s/shardsvr_shard_collection.cpp b/src/mongo/db/s/shardsvr_shard_collection.cpp
index f0d6267c844..59acabe47e6 100644
--- a/src/mongo/db/s/shardsvr_shard_collection.cpp
+++ b/src/mongo/db/s/shardsvr_shard_collection.cpp
@@ -256,7 +256,8 @@ bool validShardKeyIndexExists(OperationContext* opCtx,
// 3. If proposed key is required to be unique, additionally check for exact match.
- if (hasUsefulIndexForKey && request.getUnique() && request.getEnforceUniquenessCheck()) {
+ if (hasUsefulIndexForKey && request.getUnique() &&
+ request.getEnforceUniquenessCheck().value_or(true)) {
BSONObj eqQuery = BSON("ns" << nss.ns() << "key" << proposedKey);
BSONObj eqQueryResult;
@@ -723,7 +724,7 @@ UUID shardCollection(OperationContext* opCtx,
const auto proposedKey(request.getKey().getOwned());
const ShardKeyPattern shardKeyPattern(proposedKey);
- if (request.getImplicitlyCreateIndex()) {
+ if (request.getImplicitlyCreateIndex().value_or(true)) {
createIndexesOrValidateExisting(opCtx, nss, proposedKey, shardKeyPattern, request);
} else {
uassert(6373200,