summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMindaugas Malinauskas <mindaugas.malinauskas@mongodb.com>2020-05-26 15:50:28 +0300
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-02 16:15:41 +0000
commit55a088a9d508794f10b7a9e73774c1330410f788 (patch)
treec00973f8079ad29e2ee144193b046aee5b05d6fb
parentee6fda4258a4a73fdd74c2b40cac4bad5d1fb7cf (diff)
downloadmongo-55a088a9d508794f10b7a9e73774c1330410f788.tar.gz
SERVER-44847 Clean up explicit 'comment' fields name attached to distinct and count commands in IDL files
-rw-r--r--jstests/noPassthrough/comment_field_passthrough.js2
-rw-r--r--src/mongo/db/query/count_command.idl4
-rw-r--r--src/mongo/db/query/count_command_as_aggregation_command.cpp5
-rw-r--r--src/mongo/db/query/count_command_test.cpp2
-rw-r--r--src/mongo/db/query/distinct_command.idl4
5 files changed, 1 insertions, 16 deletions
diff --git a/jstests/noPassthrough/comment_field_passthrough.js b/jstests/noPassthrough/comment_field_passthrough.js
index 6e00d61f360..31fbea2d42b 100644
--- a/jstests/noPassthrough/comment_field_passthrough.js
+++ b/jstests/noPassthrough/comment_field_passthrough.js
@@ -42,7 +42,7 @@ const impls = {
const command = (typeof (testObj.command) === "function")
? testObj.command(state, testCase.commandArgs)
: testObj.command;
- command['comment'] = "comment";
+ command['comment'] = {comment: true};
const res = runOnDb.runCommand(command);
assert(res.ok == 1 || testCase.expectFail || res.code == ErrorCodes.CommandNotSupported,
tojson(res));
diff --git a/src/mongo/db/query/count_command.idl b/src/mongo/db/query/count_command.idl
index fc6eed0c1dc..640710d89b3 100644
--- a/src/mongo/db/query/count_command.idl
+++ b/src/mongo/db/query/count_command.idl
@@ -83,10 +83,6 @@ commands:
description: "The collation to use in the count command."
type: object
optional: true
- comment:
- description: "A comment."
- type: string
- optional: true
fields:
description: "A BSONObj added by the shell. Left in for backwards compatibility."
type: object
diff --git a/src/mongo/db/query/count_command_as_aggregation_command.cpp b/src/mongo/db/query/count_command_as_aggregation_command.cpp
index b2f03203a4f..418fe629a6a 100644
--- a/src/mongo/db/query/count_command_as_aggregation_command.cpp
+++ b/src/mongo/db/query/count_command_as_aggregation_command.cpp
@@ -43,7 +43,6 @@ const char kSkipField[] = "skip";
const char kHintField[] = "hint";
const char kCollationField[] = "collation";
const char kExplainField[] = "explain";
-const char kCommentField[] = "comment";
const char kMaxTimeMSField[] = "maxTimeMS";
const char kReadConcernField[] = "readConcern";
} // namespace
@@ -88,10 +87,6 @@ StatusWith<BSONObj> countCommandAsAggregationCommand(const CountCommand& cmd,
aggregationBuilder.append(kHintField, cmd.getHint());
- if (auto comment = cmd.getComment()) {
- aggregationBuilder.append(kCommentField, comment.get());
- }
-
if (auto maxTime = cmd.getMaxTimeMS()) {
if (maxTime.get() > 0) {
aggregationBuilder.append(kMaxTimeMSField, maxTime.get());
diff --git a/src/mongo/db/query/count_command_test.cpp b/src/mongo/db/query/count_command_test.cpp
index ca1bde54ee0..7fc17516694 100644
--- a/src/mongo/db/query/count_command_test.cpp
+++ b/src/mongo/db/query/count_command_test.cpp
@@ -61,7 +61,6 @@ TEST(CountCommandTest, ParserDealsWithMissingFieldsCorrectly) {
ASSERT_FALSE(countCmd.getCollation());
ASSERT_FALSE(countCmd.getReadConcern());
ASSERT_FALSE(countCmd.getQueryOptions());
- ASSERT_FALSE(countCmd.getComment());
}
TEST(CountCommandTest, ParserParsesCommandWithAllFieldsCorrectly) {
@@ -88,7 +87,6 @@ TEST(CountCommandTest, ParserParsesCommandWithAllFieldsCorrectly) {
ASSERT_EQ(countCmd.getLimit().get(), 100);
ASSERT_EQ(countCmd.getSkip().get(), 1000);
ASSERT_EQ(countCmd.getMaxTimeMS().get(), 10000u);
- ASSERT_EQ(countCmd.getComment().get(), "aComment");
ASSERT_BSONOBJ_EQ(countCmd.getHint(), fromjson("{ b : 5 }"));
ASSERT_BSONOBJ_EQ(countCmd.getCollation().get(), fromjson("{ locale : 'en_US' }"));
ASSERT_BSONOBJ_EQ(countCmd.getReadConcern().get(), fromjson("{ level: 'linearizable' }"));
diff --git a/src/mongo/db/query/distinct_command.idl b/src/mongo/db/query/distinct_command.idl
index b9029ad6a94..1e0e15516cd 100644
--- a/src/mongo/db/query/distinct_command.idl
+++ b/src/mongo/db/query/distinct_command.idl
@@ -51,7 +51,3 @@ commands:
description: "Optional collation for the command."
type: object
optional: true
- comment:
- description: "Optional comment."
- type: string
- optional: true