diff options
Diffstat (limited to 'src/mongo/db/index/index_descriptor.cpp')
-rw-r--r-- | src/mongo/db/index/index_descriptor.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/index/index_descriptor.cpp b/src/mongo/db/index/index_descriptor.cpp index 69fac811cd6..b276fb9b38c 100644 --- a/src/mongo/db/index/index_descriptor.cpp +++ b/src/mongo/db/index/index_descriptor.cpp @@ -41,6 +41,7 @@ #include "mongo/db/matcher/expression_parser.h" #include "mongo/db/query/collation/collator_factory_interface.h" #include "mongo/db/server_options.h" +#include "mongo/db/storage/storage_parameters_gen.h" namespace mongo { @@ -106,6 +107,7 @@ constexpr StringData IndexDescriptor::kTextVersionFieldName; constexpr StringData IndexDescriptor::kUniqueFieldName; constexpr StringData IndexDescriptor::kHiddenFieldName; constexpr StringData IndexDescriptor::kWeightsFieldName; +constexpr StringData IndexDescriptor::kDisallowNewDuplicateKeysFieldName; IndexDescriptor::IndexDescriptor(const std::string& accessMethodName, BSONObj infoObj) : _accessMethodName(accessMethodName), @@ -133,6 +135,15 @@ IndexDescriptor::IndexDescriptor(const std::string& accessMethodName, BSONObj in invariant(collationElement.isABSONObj()); _collation = collationElement.Obj().getOwned(); } + + if (BSONElement disallowNewDuplicateKeysElement = + _infoObj[kDisallowNewDuplicateKeysFieldName]) { + uassert( + ErrorCodes::InvalidOptions, + "Index does not support the 'disallowNewDuplicateKeys' field", + feature_flags::gCollModIndexUnique.isEnabled(serverGlobalParams.featureCompatibility)); + _disallowNewDuplicateKeys = disallowNewDuplicateKeysElement.trueValue(); + } } bool IndexDescriptor::isIndexVersionSupported(IndexVersion indexVersion) { |