diff options
Diffstat (limited to 'src/mongo/db/catalog/index_key_validate.cpp')
-rw-r--r-- | src/mongo/db/catalog/index_key_validate.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/mongo/db/catalog/index_key_validate.cpp b/src/mongo/db/catalog/index_key_validate.cpp index 25f7c43910f..0a027b3c2a5 100644 --- a/src/mongo/db/catalog/index_key_validate.cpp +++ b/src/mongo/db/catalog/index_key_validate.cpp @@ -133,8 +133,7 @@ Status validateKeyPattern(const BSONObj& key, IndexDescriptor::IndexVersion inde break; } - case IndexVersion::kV2: - case IndexVersion::kV2Unique: { + case IndexVersion::kV2: { if (keyElement.isNumber()) { double value = keyElement.number(); if (std::isnan(value)) { @@ -220,7 +219,6 @@ StatusWith<BSONObj> validateIndexSpec( bool hasNamespaceField = false; bool hasVersionField = false; bool hasCollationField = false; - bool isUniqueIndex = false; auto fieldNamesValidStatus = validateIndexSpecFieldNames(indexSpec); if (!fieldNamesValidStatus.isOK()) { @@ -365,13 +363,6 @@ StatusWith<BSONObj> validateIndexSpec( if (!statusWithMatcher.isOK()) { return statusWithMatcher.getStatus(); } - } else if (IndexDescriptor::kUniqueFieldName == indexSpecElemFieldName) { - // Note: Here we only consider whether or not "unique" field is specified and that its - // value evaluates to true. "_id" index for instance is unique, but the index spec for - // it doesn't carry a "unique" field. "isUniqueIndex" being false for "_id" indexes is - // on purpose, and in future if we were to make "_id" index specs include - // "unique:true", then we would need to change the logic here to preserve its behavior. - isUniqueIndex = indexSpecElem.trueValue(); } else { // We can assume field name is valid at this point. Validation of fieldname is handled // prior to this in validateIndexSpecFieldNames(). @@ -380,8 +371,7 @@ StatusWith<BSONObj> validateIndexSpec( } if (!resolvedIndexVersion) { - resolvedIndexVersion = IndexDescriptor::getDefaultIndexVersion( - featureCompatibility.getVersion(), isUniqueIndex); + resolvedIndexVersion = IndexDescriptor::getDefaultIndexVersion(); } if (!hasKeyPatternField) { |