summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorDaniel Gómez Ferro <daniel.gomezferro@mongodb.com>2022-02-02 07:59:01 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-02 08:46:57 +0000
commitc7f5e389e4488fcf7bd7a9a2ca4149080c409242 (patch)
treed1a14dfeaef42df491009b45db32c5b7f3ab6a3d /src/mongo/db
parent98d1971726bc2bc7bd8d13365291d79bb9b61a6e (diff)
downloadmongo-c7f5e389e4488fcf7bd7a9a2ca4149080c409242.tar.gz
SERVER-62811 Allow special index types on cluster keys
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/clustered_collection_util.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/clustered_collection_util.cpp b/src/mongo/db/catalog/clustered_collection_util.cpp
index 8380f1fb4d4..c79adca9054 100644
--- a/src/mongo/db/catalog/clustered_collection_util.cpp
+++ b/src/mongo/db/catalog/clustered_collection_util.cpp
@@ -136,6 +136,12 @@ bool matchesClusterKey(const BSONObj& keyPatternObj,
// Clustered key cannot be compound.
return false;
}
+
+ if (!keyPatternObj.firstElement().isNumber()) {
+ // Clustered index can't be of any special type.
+ return false;
+ }
+
return keyPatternObj.firstElement().fieldNameStringData() ==
collInfo->getIndexSpec().getKey().firstElement().fieldNameStringData();
}