summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/index_descriptor.cpp
diff options
context:
space:
mode:
authorZhihui Fan <yizhi.fzh@alibaba-inc.com>2020-02-04 08:09:01 +0800
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-22 16:47:37 +0000
commitbad7c538e7efbc996a6089e1569681edf24e6b33 (patch)
tree07aa2c5b48062ed36d147a682f06beeb4d6f9f69 /src/mongo/db/index/index_descriptor.cpp
parent17edea396d470d0ddc258674feba030ffafbffe8 (diff)
downloadmongo-bad7c538e7efbc996a6089e1569681edf24e6b33.tar.gz
SERVER-9306 Ability to temporarily forbid query optimizer from using index ("Hidden Index") SERVER-47275 Take over and complete Hidden Indexes PR
Co-authored-by: Ruoxin Xu <ruoxin.xu@mongodb.com>
Diffstat (limited to 'src/mongo/db/index/index_descriptor.cpp')
-rw-r--r--src/mongo/db/index/index_descriptor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/index/index_descriptor.cpp b/src/mongo/db/index/index_descriptor.cpp
index 248e87e8b91..17f765d87cf 100644
--- a/src/mongo/db/index/index_descriptor.cpp
+++ b/src/mongo/db/index/index_descriptor.cpp
@@ -61,7 +61,8 @@ void populateOptionsMap(std::map<StringData, BSONElement>& theMap, const BSONObj
IndexDescriptor::kBackgroundFieldName || // this is a creation time option only
fieldName == IndexDescriptor::kDropDuplicatesFieldName || // this is now ignored
fieldName == IndexDescriptor::kSparseFieldName || // checked specially
- fieldName == IndexDescriptor::kUniqueFieldName // check specially
+ fieldName == IndexDescriptor::kHiddenFieldName || // not considered for equivalence
+ fieldName == IndexDescriptor::kUniqueFieldName // check specially
) {
continue;
}
@@ -93,6 +94,7 @@ constexpr StringData IndexDescriptor::kSparseFieldName;
constexpr StringData IndexDescriptor::kStorageEngineFieldName;
constexpr StringData IndexDescriptor::kTextVersionFieldName;
constexpr StringData IndexDescriptor::kUniqueFieldName;
+constexpr StringData IndexDescriptor::kHiddenFieldName;
constexpr StringData IndexDescriptor::kWeightsFieldName;
IndexDescriptor::IndexDescriptor(Collection* collection,
@@ -109,6 +111,7 @@ IndexDescriptor::IndexDescriptor(Collection* collection,
_isIdIndex(isIdIndexPattern(_keyPattern)),
_sparse(infoObj[IndexDescriptor::kSparseFieldName].trueValue()),
_unique(_isIdIndex || infoObj[kUniqueFieldName].trueValue()),
+ _hidden(infoObj[kHiddenFieldName].trueValue()),
_partial(!infoObj[kPartialFilterExprFieldName].eoo()),
_cachedEntry(nullptr) {
BSONElement e = _infoObj[IndexDescriptor::kIndexVersionFieldName];