summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_create_cmd.cpp
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2020-12-08 13:46:28 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-12-09 00:04:39 +0000
commit203ed70069a9c16af767d00f459cdcd9114d13b5 (patch)
treee923181b62ae014435fd11b4d46b5be8293973fc /src/mongo/s/commands/cluster_create_cmd.cpp
parent7c51aca7fd085ead0ae3e19d967ff1abf111d13a (diff)
downloadmongo-203ed70069a9c16af767d00f459cdcd9114d13b5.tar.gz
SERVER-52538 Update IDL for "create" command, part 1
Diffstat (limited to 'src/mongo/s/commands/cluster_create_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_create_cmd.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/s/commands/cluster_create_cmd.cpp b/src/mongo/s/commands/cluster_create_cmd.cpp
index 2a4f2fd7dab..35c15cd890a 100644
--- a/src/mongo/s/commands/cluster_create_cmd.cpp
+++ b/src/mongo/s/commands/cluster_create_cmd.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands.h"
+#include "mongo/db/commands/create_gen.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/s/cluster_commands_helpers.h"
@@ -115,12 +116,12 @@ public:
const std::string& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs(dbName, cmdObj));
- createShardDatabase(opCtx, dbName);
+ auto cmd = CreateCommand::parse({"create"}, cmdObj);
+ createShardDatabase(opCtx, cmd.getDbName());
uassert(ErrorCodes::InvalidOptions,
"specify size:<n> when capped is true",
- !cmdObj["capped"].trueValue() || cmdObj["size"].isNumber());
+ !cmd.getCapped() || cmd.getSize());
uassert(ErrorCodes::InvalidOptions,
"the 'temp' field is an invalid option",
!cmdObj.hasField("temp"));
@@ -145,7 +146,7 @@ public:
// NamespaceExists will cause multi-document transactions to implicitly abort, so
// mongos should surface this error to the client.
CollectionOptions options = uassertStatusOK(CollectionOptions::parse(cmdObj));
- checkCollectionOptions(opCtx, nss, options);
+ checkCollectionOptions(opCtx, cmd.getNamespace(), options);
} else {
uassertStatusOK(createStatus);
}