summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin Yee Tan <shinyee.tan@mongodb.com>2022-02-04 19:23:23 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-07 20:27:15 +0000
commitccd044ecf761baf8a8cb6487b2ebe676e6611599 (patch)
tree9d844e6f7c7d3fb76fc5b6f1422f403eeded5a09 /src
parente30f2dc4640aee62e0e5d75a017d5177f59b0b08 (diff)
downloadmongo-ccd044ecf761baf8a8cb6487b2ebe676e6611599.tar.gz
Revert "SERVER-62209 Add 'comment' option to 'createIndex' command"
This reverts commit f395e9d34b413781bcfb67c2674378734223466c.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/index_key_validate.cpp10
-rw-r--r--src/mongo/db/create_indexes.idl4
-rw-r--r--src/mongo/db/index/index_descriptor.cpp6
-rw-r--r--src/mongo/db/index/index_descriptor.h6
-rw-r--r--src/mongo/db/list_indexes.idl4
5 files changed, 1 insertions, 29 deletions
diff --git a/src/mongo/db/catalog/index_key_validate.cpp b/src/mongo/db/catalog/index_key_validate.cpp
index dd34e285e51..caa209fd3c3 100644
--- a/src/mongo/db/catalog/index_key_validate.cpp
+++ b/src/mongo/db/catalog/index_key_validate.cpp
@@ -94,7 +94,6 @@ static std::set<StringData> allowedFieldNames = {
IndexDescriptor::kUniqueFieldName,
IndexDescriptor::kWeightsFieldName,
IndexDescriptor::kOriginalSpecFieldName,
- IndexDescriptor::kCommentFieldName,
// Index creation under legacy writeMode can result in an index spec with an _id field.
"_id"};
@@ -501,7 +500,7 @@ StatusWith<BSONObj> validateIndexSpec(OperationContext* opCtx, const BSONObj& in
"clustered" == indexSpecElemFieldName) &&
!indexSpecElem.isNumber() && !indexSpecElem.isBoolean()) {
return {ErrorCodes::TypeMismatch,
- str::stream() << "The field '" << indexSpecElemFieldName << "' has value "
+ str::stream() << "The field '" << indexSpecElemFieldName << " has value "
<< indexSpecElem.toString()
<< ", which is not convertible to bool"};
} else if ((IndexDescriptor::kDefaultLanguageFieldName == indexSpecElemFieldName ||
@@ -521,13 +520,6 @@ StatusWith<BSONObj> validateIndexSpec(OperationContext* opCtx, const BSONObj& in
str::stream() << "The field '" << indexSpecElemFieldName
<< "' must be a number, but got "
<< typeName(indexSpecElem.type())};
- } else if (IndexDescriptor::kCommentFieldName == indexSpecElemFieldName) {
- if (indexSpecElem.type() != BSONType::Object) {
- return {ErrorCodes::TypeMismatch,
- str::stream()
- << "The field '" << IndexDescriptor::kCommentFieldName
- << "' must be an object, but got " << typeName(indexSpecElem.type())};
- }
} else {
// We can assume field name is valid at this point. Validation of fieldname is handled
// prior to this in validateIndexSpecFieldNames().
diff --git a/src/mongo/db/create_indexes.idl b/src/mongo/db/create_indexes.idl
index d00b8f75801..812b0e3a40f 100644
--- a/src/mongo/db/create_indexes.idl
+++ b/src/mongo/db/create_indexes.idl
@@ -180,10 +180,6 @@ structs:
type: safeBool
optional: true
unstable: false
- comment:
- type: object_owned
- optional: true
- unstable: true
commands:
createIndexes:
description: "Command for creating indexes on a collection"
diff --git a/src/mongo/db/index/index_descriptor.cpp b/src/mongo/db/index/index_descriptor.cpp
index 07ae8f1cdc5..69fac811cd6 100644
--- a/src/mongo/db/index/index_descriptor.cpp
+++ b/src/mongo/db/index/index_descriptor.cpp
@@ -106,7 +106,6 @@ constexpr StringData IndexDescriptor::kTextVersionFieldName;
constexpr StringData IndexDescriptor::kUniqueFieldName;
constexpr StringData IndexDescriptor::kHiddenFieldName;
constexpr StringData IndexDescriptor::kWeightsFieldName;
-constexpr StringData IndexDescriptor::kCommentFieldName;
IndexDescriptor::IndexDescriptor(const std::string& accessMethodName, BSONObj infoObj)
: _accessMethodName(accessMethodName),
@@ -134,11 +133,6 @@ IndexDescriptor::IndexDescriptor(const std::string& accessMethodName, BSONObj in
invariant(collationElement.isABSONObj());
_collation = collationElement.Obj().getOwned();
}
-
- if (BSONElement commentElement = _infoObj[kCommentFieldName]) {
- invariant(commentElement.isABSONObj());
- _comment = commentElement.Obj().getOwned();
- }
}
bool IndexDescriptor::isIndexVersionSupported(IndexVersion indexVersion) {
diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h
index 5cc47c3564e..76e5dce4c91 100644
--- a/src/mongo/db/index/index_descriptor.h
+++ b/src/mongo/db/index/index_descriptor.h
@@ -88,7 +88,6 @@ public:
static constexpr StringData kUniqueFieldName = "unique"_sd;
static constexpr StringData kWeightsFieldName = "weights"_sd;
static constexpr StringData kOriginalSpecFieldName = "originalSpec"_sd;
- static constexpr StringData kCommentFieldName = "comment"_sd;
/**
* infoObj is a copy of the index-describing BSONObj contained in the catalog.
@@ -227,10 +226,6 @@ public:
return _partialFilterExpression;
}
- const BSONObj& comment() const {
- return _comment;
- }
-
/**
* Returns true if the key pattern is for the _id index.
* The _id index must have form exactly {_id : 1} or {_id : -1}.
@@ -280,7 +275,6 @@ private:
IndexVersion _version;
BSONObj _collation;
BSONObj _partialFilterExpression;
- BSONObj _comment;
// Many query stages require going from an IndexDescriptor to its IndexCatalogEntry, so for
// now we need this.
diff --git a/src/mongo/db/list_indexes.idl b/src/mongo/db/list_indexes.idl
index c577fcb7945..10d78a0479d 100644
--- a/src/mongo/db/list_indexes.idl
+++ b/src/mongo/db/list_indexes.idl
@@ -156,10 +156,6 @@ structs:
type: safeBool
optional: true
unstable: false
- comment:
- type: object_owned
- optional: true
- unstable: true
#
# Depending on the values of includeIndexBuildInfo and includeBuildUUIDs, indexes may
# appear with a combination of these three fields. Specifically, if includeIndexBuildInfo