diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2021-08-04 13:04:53 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-04 14:03:01 +0000 |
commit | 946bcddd52832ea615fb43cbd5fd85b0278f98cc (patch) | |
tree | 20823b559d0a4fb007226dc1e0216535224bd24a /src/mongo/db/catalog/collection_impl.cpp | |
parent | 35c2b631b6efa1af9909d1c6edaef10d7dbacc1e (diff) | |
download | mongo-946bcddd52832ea615fb43cbd5fd85b0278f98cc.tar.gz |
SERVER-58779 Store the original user index definition on the transformed index definition on the buckets collection
Diffstat (limited to 'src/mongo/db/catalog/collection_impl.cpp')
-rw-r--r-- | src/mongo/db/catalog/collection_impl.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp index 95d1ab98095..ba8addcc4bb 100644 --- a/src/mongo/db/catalog/collection_impl.cpp +++ b/src/mongo/db/catalog/collection_impl.cpp @@ -1631,7 +1631,7 @@ StatusWith<std::vector<BSONObj>> CollectionImpl::addCollationDefaultsToIndexSpec << "failed to add collation information to index spec for index creation: " << originalIndexSpec); } - const auto& newIndexSpec = validateResult.getValue(); + BSONObj newIndexSpec = validateResult.getValue(); auto keyPattern = newIndexSpec[IndexDescriptor::kKeyPatternFieldName].Obj(); if (IndexDescriptor::isIdIndexPattern(keyPattern)) { @@ -1656,6 +1656,18 @@ StatusWith<std::vector<BSONObj>> CollectionImpl::addCollationDefaultsToIndexSpec } } + if (originalIndexSpec.hasField(IndexDescriptor::kOriginalSpecFieldName)) { + // Validation was already performed above. + BSONObj newOriginalIndexSpec = invariant(index_key_validate::validateIndexSpecCollation( + opCtx, + originalIndexSpec.getObjectField(IndexDescriptor::kOriginalSpecFieldName), + collator)); + + BSONObj specToAdd = + BSON(IndexDescriptor::kOriginalSpecFieldName << newOriginalIndexSpec); + newIndexSpec = newIndexSpec.addField(specToAdd.firstElement()); + } + newIndexSpecs.push_back(newIndexSpec); } |