From c7f5e389e4488fcf7bd7a9a2ca4149080c409242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20G=C3=B3mez=20Ferro?= Date: Wed, 2 Feb 2022 07:59:01 +0000 Subject: SERVER-62811 Allow special index types on cluster keys --- src/mongo/db/catalog/clustered_collection_util.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mongo/db') 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(); } -- cgit v1.2.1