summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_collection_mod_cmd.cpp
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-01-24 23:17:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-26 22:56:54 +0000
commite1b123d6c2da868a9ef7f1468e140dd102a35020 (patch)
tree542768e6efba52ed8170c7c0f4ef3e5d2f41cff4 /src/mongo/s/commands/cluster_collection_mod_cmd.cpp
parent86859a7dfe85a211b869361776bca0d116814bb1 (diff)
downloadmongo-e1b123d6c2da868a9ef7f1468e140dd102a35020.tar.gz
SERVER-53145 Specify input/output to collMod command in IDL
Diffstat (limited to 'src/mongo/s/commands/cluster_collection_mod_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_collection_mod_cmd.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/s/commands/cluster_collection_mod_cmd.cpp b/src/mongo/s/commands/cluster_collection_mod_cmd.cpp
index 6296c71a8d6..c421dc5ba72 100644
--- a/src/mongo/s/commands/cluster_collection_mod_cmd.cpp
+++ b/src/mongo/s/commands/cluster_collection_mod_cmd.cpp
@@ -32,6 +32,7 @@
#include "mongo/platform/basic.h"
#include "mongo/db/auth/authorization_session.h"
+#include "mongo/db/coll_mod_gen.h"
#include "mongo/db/commands.h"
#include "mongo/logv2/log.h"
#include "mongo/s/cluster_commands_helpers.h"
@@ -72,7 +73,12 @@ public:
const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& output) override {
- const NamespaceString nss(CommandHelpers::parseNsCollectionRequired(dbName, cmdObj));
+ auto cmd = CollMod::parse(
+ IDLParserErrorContext(CollMod::kCommandName,
+ APIParameters::get(opCtx).getAPIStrict().value_or(false)),
+ cmdObj);
+
+ auto nss = cmd.getNamespace();
LOGV2_DEBUG(22748,
1,
"collMod: {namespace} cmd: {command}",
@@ -84,11 +90,13 @@ public:
uassertStatusOK(Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfo(opCtx, nss));
auto shardResponses = scatterGatherVersionedTargetByRoutingTable(
opCtx,
- nss.db(),
+ cmd.getDbName(),
nss,
routingInfo,
applyReadWriteConcern(
- opCtx, this, CommandHelpers::filterCommandRequestForPassthrough(cmdObj)),
+ opCtx,
+ this,
+ CommandHelpers::filterCommandRequestForPassthrough(cmd.toBSON(BSONObj()))),
ReadPreferenceSetting::get(opCtx),
Shard::RetryPolicy::kNoRetry,
BSONObj() /* query */,