summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorSophia Tan <sophia_tll@hotmail.com>2022-08-03 18:14:03 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-10 04:10:22 +0000
commite008eb5f1e07997139ae3acd81152b6180e9e312 (patch)
tree70fe5516b13661f1007f1cc1bf4d3208b932e3e6 /src/mongo/s
parent1ad5ef42f5161542550262647ab79e85cc6a7cf2 (diff)
downloadmongo-e008eb5f1e07997139ae3acd81152b6180e9e312.tar.gz
SERVER-67459 Change BasicCommand to use DatabaseName
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/commands/cluster_add_shard_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_build_info.cpp2
-rw-r--r--src/mongo/s/commands/cluster_coll_stats_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_compact_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_control_balancer_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_convert_to_capped_cmd.cpp17
-rw-r--r--src/mongo/s/commands/cluster_distinct_cmd.cpp6
-rw-r--r--src/mongo/s/commands/cluster_filemd5_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_find_and_modify_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_last_error_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_shard_version_cmd.cpp5
-rw-r--r--src/mongo/s/commands/cluster_index_filter_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_is_db_grid_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_kill_op.cpp6
-rw-r--r--src/mongo/s/commands/cluster_list_shards_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_move_primary_cmd.cpp5
-rw-r--r--src/mongo/s/commands/cluster_multicast_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_netstat_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_oplog_note_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_remove_shard_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_repair_sharded_collection_chunks_history_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_rwc_defaults_commands.cpp2
-rw-r--r--src/mongo/s/commands/cluster_set_free_monitoring_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_set_index_commit_quorum_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_shard_collection_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_split_vector_cmd.cpp8
-rw-r--r--src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_validate_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp2
-rw-r--r--src/mongo/s/commands/flush_router_config_cmd.cpp2
-rw-r--r--src/mongo/s/commands/get_shard_map_cmd.cpp2
34 files changed, 62 insertions, 57 deletions
diff --git a/src/mongo/s/commands/cluster_add_shard_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_cmd.cpp
index 25831702d90..9b7e013accd 100644
--- a/src/mongo/s/commands/cluster_add_shard_cmd.cpp
+++ b/src/mongo/s/commands/cluster_add_shard_cmd.cpp
@@ -74,7 +74,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto parsedRequest = uassertStatusOK(AddShardRequest::parseFromMongosCommand(cmdObj));
diff --git a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
index 764b154bbd0..4c6dc7e762b 100644
--- a/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
+++ b/src/mongo/s/commands/cluster_add_shard_to_zone_cmd.cpp
@@ -101,7 +101,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto parsedRequest = uassertStatusOK(AddShardToZoneRequest::parseFromMongosCommand(cmdObj));
diff --git a/src/mongo/s/commands/cluster_build_info.cpp b/src/mongo/s/commands/cluster_build_info.cpp
index 742ab9832eb..c946ab8e6af 100644
--- a/src/mongo/s/commands/cluster_build_info.cpp
+++ b/src/mongo/s/commands/cluster_build_info.cpp
@@ -100,7 +100,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& jsobj,
BSONObjBuilder& result) final {
VersionInfoInterface::instance().appendBuildInfo(&result);
diff --git a/src/mongo/s/commands/cluster_coll_stats_cmd.cpp b/src/mongo/s/commands/cluster_coll_stats_cmd.cpp
index fc879a34605..25b3e15b578 100644
--- a/src/mongo/s/commands/cluster_coll_stats_cmd.cpp
+++ b/src/mongo/s/commands/cluster_coll_stats_cmd.cpp
@@ -191,10 +191,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbName}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
const auto targeter = ChunkManagerTargeter(opCtx, nss);
const auto cm = targeter.getRoutingInfo();
diff --git a/src/mongo/s/commands/cluster_compact_cmd.cpp b/src/mongo/s/commands/cluster_compact_cmd.cpp
index f5df95fbe92..055e8d81688 100644
--- a/src/mongo/s/commands/cluster_compact_cmd.cpp
+++ b/src/mongo/s/commands/cluster_compact_cmd.cpp
@@ -59,7 +59,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
uasserted(ErrorCodes::CommandNotSupported, "compact not allowed through mongos");
diff --git a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
index c7ac1734bb8..2cf2bfd5eef 100644
--- a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
+++ b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
@@ -86,7 +86,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
diff --git a/src/mongo/s/commands/cluster_convert_to_capped_cmd.cpp b/src/mongo/s/commands/cluster_convert_to_capped_cmd.cpp
index 7251ddc61c6..35f7e9d9701 100644
--- a/src/mongo/s/commands/cluster_convert_to_capped_cmd.cpp
+++ b/src/mongo/s/commands/cluster_convert_to_capped_cmd.cpp
@@ -42,7 +42,7 @@ namespace mongo {
namespace {
bool nonShardedCollectionCommandPassthrough(OperationContext* opCtx,
- StringData dbName,
+ const DatabaseName& dbName,
const NamespaceString& nss,
const ChunkManager& cm,
const BSONObj& cmdObj,
@@ -53,8 +53,15 @@ bool nonShardedCollectionCommandPassthrough(OperationContext* opCtx,
str::stream() << "Can't do command: " << cmdName << " on a sharded collection",
!cm.isSharded());
- auto responses = scatterGatherVersionedTargetByRoutingTable(
- opCtx, dbName, nss, cm, cmdObj, ReadPreferenceSetting::get(opCtx), retryPolicy, {}, {});
+ auto responses = scatterGatherVersionedTargetByRoutingTable(opCtx,
+ dbName.toStringWithTenantId(),
+ nss,
+ cm,
+ cmdObj,
+ ReadPreferenceSetting::get(opCtx),
+ retryPolicy,
+ {},
+ {});
invariant(responses.size() == 1);
const auto cmdResponse = uassertStatusOK(std::move(responses.front().swResponse));
@@ -93,10 +100,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbName}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
const auto cm =
uassertStatusOK(Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfo(opCtx, nss));
uassert(ErrorCodes::IllegalOperation,
diff --git a/src/mongo/s/commands/cluster_distinct_cmd.cpp b/src/mongo/s/commands/cluster_distinct_cmd.cpp
index b15ed932677..a14afdd4063 100644
--- a/src/mongo/s/commands/cluster_distinct_cmd.cpp
+++ b/src/mongo/s/commands/cluster_distinct_cmd.cpp
@@ -181,11 +181,11 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
CommandHelpers::handleMarkKillOnClientDisconnect(opCtx);
- const NamespaceString nss(parseNs({boost::none, dbName}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
auto parsedDistinctCmd =
ParsedDistinct::parse(opCtx, nss, cmdObj, ExtensionsCallbackNoop(), false);
@@ -249,7 +249,7 @@ public:
}
BSONObj aggResult = CommandHelpers::runCommandDirectly(
- opCtx, OpMsgRequest::fromDBAndBody(dbName, std::move(resolvedAggCmd)));
+ opCtx, OpMsgRequest::fromDBAndBody(dbName.db(), std::move(resolvedAggCmd)));
ViewResponseFormatter formatter(aggResult);
auto formatStatus = formatter.appendAsDistinctResponse(&result);
diff --git a/src/mongo/s/commands/cluster_filemd5_cmd.cpp b/src/mongo/s/commands/cluster_filemd5_cmd.cpp
index 0bd0a711fc2..3922205749c 100644
--- a/src/mongo/s/commands/cluster_filemd5_cmd.cpp
+++ b/src/mongo/s/commands/cluster_filemd5_cmd.cpp
@@ -82,10 +82,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbName}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
const auto cm =
uassertStatusOK(Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfo(opCtx, nss));
diff --git a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp
index 657e1e9086d..f789a6cf7b2 100644
--- a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp
+++ b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp
@@ -457,7 +457,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
const NamespaceString nss(CommandHelpers::parseNsCollectionRequired(dbName, cmdObj));
diff --git a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp
index 2e7766c4767..008a4d349e3 100644
--- a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp
@@ -61,7 +61,7 @@ public:
return false;
}
- virtual bool run(OperationContext*, const std::string&, const BSONObj&, BSONObjBuilder&) {
+ virtual bool run(OperationContext*, const DatabaseName&, const BSONObj&, BSONObjBuilder&) {
uasserted(5739001, "getLastError command is not supported");
return false;
}
diff --git a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
index 94e4b2a6cf4..5b4eebb96b8 100644
--- a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
@@ -85,11 +85,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbname}, cmdObj));
-
+ const NamespaceString nss(parseNs(dbName, cmdObj));
const auto catalogCache = Grid::get(opCtx)->catalogCache();
if (nss.coll().empty()) {
diff --git a/src/mongo/s/commands/cluster_index_filter_cmd.cpp b/src/mongo/s/commands/cluster_index_filter_cmd.cpp
index eafe9b8b539..26fecc0ae19 100644
--- a/src/mongo/s/commands/cluster_index_filter_cmd.cpp
+++ b/src/mongo/s/commands/cluster_index_filter_cmd.cpp
@@ -87,10 +87,10 @@ public:
// Cluster plan cache command entry point.
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbname}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
const BSONObj query;
const auto routingInfo =
uassertStatusOK(Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfo(opCtx, nss));
diff --git a/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp b/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp
index c5e2358b6eb..6fc4f1b9263 100644
--- a/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp
@@ -58,7 +58,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
result.append("isdbgrid", 1);
diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp
index 90cfb4eda20..8a49520da77 100644
--- a/src/mongo/s/commands/cluster_kill_op.cpp
+++ b/src/mongo/s/commands/cluster_kill_op.cpp
@@ -58,7 +58,7 @@ namespace {
class ClusterKillOpCommand : public KillOpCmdBase {
public:
bool run(OperationContext* opCtx,
- const std::string& db,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) final {
BSONElement element = cmdObj.getField("op");
@@ -67,14 +67,14 @@ public:
if (isKillingLocalOp(element)) {
const unsigned int opId = KillOpCmdBase::parseOpId(cmdObj);
killLocalOperation(opCtx, opId);
- reportSuccessfulCompletion(opCtx, db, cmdObj);
+ reportSuccessfulCompletion(opCtx, dbName, cmdObj);
// killOp always reports success once past the auth check.
return true;
} else if (element.type() == BSONType::String) {
// It's a string. Should be of the form shardid:opid.
if (_killShardOperation(opCtx, element.str(), result)) {
- reportSuccessfulCompletion(opCtx, db, cmdObj);
+ reportSuccessfulCompletion(opCtx, dbName, cmdObj);
return true;
} else {
return false;
diff --git a/src/mongo/s/commands/cluster_list_shards_cmd.cpp b/src/mongo/s/commands/cluster_list_shards_cmd.cpp
index 9834a1524dd..cb5fb91c6ec 100644
--- a/src/mongo/s/commands/cluster_list_shards_cmd.cpp
+++ b/src/mongo/s/commands/cluster_list_shards_cmd.cpp
@@ -65,7 +65,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
const auto opTimeWithShards =
diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp
index 665fbc79dd4..b39a3f7f23d 100644
--- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp
+++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp
@@ -91,12 +91,11 @@ public:
}
virtual bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
auto request = MovePrimary::parse(IDLParserContext("MovePrimary"), cmdObj);
-
- const string db = parseNs({boost::none, ""}, cmdObj).dbName().db();
+ const string db = parseNs(dbName, cmdObj).dbName().db();
const StringData toShard(request.getTo());
// Invalidate the routing table cache entry for this database so that we reload the
diff --git a/src/mongo/s/commands/cluster_multicast_cmd.cpp b/src/mongo/s/commands/cluster_multicast_cmd.cpp
index 4a38364c63b..90ff772122f 100644
--- a/src/mongo/s/commands/cluster_multicast_cmd.cpp
+++ b/src/mongo/s/commands/cluster_multicast_cmd.cpp
@@ -88,7 +88,7 @@ public:
std::vector<Privilege>* out) const override {}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
IDLParserContext ctx("ClusterMulticast");
diff --git a/src/mongo/s/commands/cluster_netstat_cmd.cpp b/src/mongo/s/commands/cluster_netstat_cmd.cpp
index 273dd738d24..1b1fd469d6c 100644
--- a/src/mongo/s/commands/cluster_netstat_cmd.cpp
+++ b/src/mongo/s/commands/cluster_netstat_cmd.cpp
@@ -66,7 +66,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto const shardRegistry = Grid::get(opCtx)->shardRegistry();
diff --git a/src/mongo/s/commands/cluster_oplog_note_cmd.cpp b/src/mongo/s/commands/cluster_oplog_note_cmd.cpp
index 1d4877ced9e..12c16f58ffc 100644
--- a/src/mongo/s/commands/cluster_oplog_note_cmd.cpp
+++ b/src/mongo/s/commands/cluster_oplog_note_cmd.cpp
@@ -83,13 +83,13 @@ public:
}
virtual bool run(OperationContext* opCtx,
- const string& dbname,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
auto shardResponses = scatterGatherUnversionedTargetAllShards(
opCtx,
- dbname,
+ dbName.toStringWithTenantId(),
applyReadWriteConcern(
opCtx, this, CommandHelpers::filterCommandRequestForPassthrough(cmdObj)),
ReadPreferenceSetting::get(opCtx),
diff --git a/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp
index 1736e5eb233..cd042d46071 100644
--- a/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp
+++ b/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp
@@ -87,13 +87,13 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result);
} clusterPlanCacheClearCmd;
bool ClusterPlanCacheClearCmd::run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
const NamespaceString nss(CommandHelpers::parseNsCollectionRequired(dbName, cmdObj));
diff --git a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp
index 20eb7f1c525..ef31d7dce15 100644
--- a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp
+++ b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp
@@ -72,7 +72,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
uassert(ErrorCodes::TypeMismatch,
diff --git a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
index 74f4fadaea1..4b63870523a 100644
--- a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
+++ b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp
@@ -113,7 +113,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
auto parsedRequest =
diff --git a/src/mongo/s/commands/cluster_repair_sharded_collection_chunks_history_cmd.cpp b/src/mongo/s/commands/cluster_repair_sharded_collection_chunks_history_cmd.cpp
index d78f985dad0..a3b154f0a1c 100644
--- a/src/mongo/s/commands/cluster_repair_sharded_collection_chunks_history_cmd.cpp
+++ b/src/mongo/s/commands/cluster_repair_sharded_collection_chunks_history_cmd.cpp
@@ -90,10 +90,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& unusedDbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss{parseNs({boost::none, unusedDbName}, cmdObj)};
+ const NamespaceString nss{parseNs(dbName, cmdObj)};
BSONObjBuilder cmdBuilder(
BSON("_configsvrRepairShardedCollectionChunksHistory" << nss.ns()));
diff --git a/src/mongo/s/commands/cluster_rwc_defaults_commands.cpp b/src/mongo/s/commands/cluster_rwc_defaults_commands.cpp
index 58d6c63891a..45b0652e37f 100644
--- a/src/mongo/s/commands/cluster_rwc_defaults_commands.cpp
+++ b/src/mongo/s/commands/cluster_rwc_defaults_commands.cpp
@@ -54,7 +54,7 @@ public:
ClusterSetDefaultRWConcernCommand() : BasicCommand("setDefaultRWConcern") {}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
diff --git a/src/mongo/s/commands/cluster_set_free_monitoring_cmd.cpp b/src/mongo/s/commands/cluster_set_free_monitoring_cmd.cpp
index d54cd80b219..f6f8b03b61a 100644
--- a/src/mongo/s/commands/cluster_set_free_monitoring_cmd.cpp
+++ b/src/mongo/s/commands/cluster_set_free_monitoring_cmd.cpp
@@ -62,7 +62,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) final {
uasserted(ErrorCodes::CommandFailed, help());
diff --git a/src/mongo/s/commands/cluster_set_index_commit_quorum_cmd.cpp b/src/mongo/s/commands/cluster_set_index_commit_quorum_cmd.cpp
index 976bd8b6ba0..cd066471f04 100644
--- a/src/mongo/s/commands/cluster_set_index_commit_quorum_cmd.cpp
+++ b/src/mongo/s/commands/cluster_set_index_commit_quorum_cmd.cpp
@@ -98,7 +98,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
const NamespaceString nss(CommandHelpers::parseNsCollectionRequired(dbName, cmdObj));
diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
index f8cc1052dd9..86ccca809e8 100644
--- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
+++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
@@ -83,10 +83,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbname}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
uassert(5731501,
"Sharding a buckets collection is not allowed",
diff --git a/src/mongo/s/commands/cluster_split_vector_cmd.cpp b/src/mongo/s/commands/cluster_split_vector_cmd.cpp
index 0e65f23ced6..4b0e66418b5 100644
--- a/src/mongo/s/commands/cluster_split_vector_cmd.cpp
+++ b/src/mongo/s/commands/cluster_split_vector_cmd.cpp
@@ -69,13 +69,13 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
- const NamespaceString nss(parseNs({boost::none, dbName}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
uassert(ErrorCodes::IllegalOperation,
"Performing splitVector across dbs isn't supported via mongos",
- nss.db() == dbName);
+ nss.dbName() == dbName);
const auto cm =
uassertStatusOK(Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfo(opCtx, nss));
@@ -95,7 +95,7 @@ public:
auto commandResponse = uassertStatusOK(shard->runCommandWithFixedRetryAttempts(
opCtx,
ReadPreferenceSetting::get(opCtx),
- dbName,
+ dbName.toStringWithTenantId(),
cm.dbPrimary() == ShardId::kConfigServerId ? filteredCmdObj : filteredCmdObjWithVersion,
Shard::RetryPolicy::kIdempotent));
diff --git a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
index cdf546f7c70..197363e9173 100644
--- a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
+++ b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp
@@ -126,7 +126,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
auto parsedRequest =
diff --git a/src/mongo/s/commands/cluster_validate_cmd.cpp b/src/mongo/s/commands/cluster_validate_cmd.cpp
index 7adec5863b5..e54997ace56 100644
--- a/src/mongo/s/commands/cluster_validate_cmd.cpp
+++ b/src/mongo/s/commands/cluster_validate_cmd.cpp
@@ -70,10 +70,10 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbName,
+ const DatabaseName& dbName,
const BSONObj& cmdObj,
BSONObjBuilder& output) override {
- const NamespaceString nss(parseNs({boost::none, dbName}, cmdObj));
+ const NamespaceString nss(parseNs(dbName, cmdObj));
const auto routingInfo =
uassertStatusOK(Grid::get(opCtx)->catalogCache()->getCollectionRoutingInfo(opCtx, nss));
diff --git a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp
index 1de8fc6f9c1..d8581f2706e 100644
--- a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp
+++ b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp
@@ -62,7 +62,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
result << "you" << cc().getRemote().toString();
diff --git a/src/mongo/s/commands/flush_router_config_cmd.cpp b/src/mongo/s/commands/flush_router_config_cmd.cpp
index a81f2832564..addbd88edfc 100644
--- a/src/mongo/s/commands/flush_router_config_cmd.cpp
+++ b/src/mongo/s/commands/flush_router_config_cmd.cpp
@@ -76,7 +76,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto const grid = Grid::get(opCtx);
diff --git a/src/mongo/s/commands/get_shard_map_cmd.cpp b/src/mongo/s/commands/get_shard_map_cmd.cpp
index 7a54d59fc75..bbdf20d5ff0 100644
--- a/src/mongo/s/commands/get_shard_map_cmd.cpp
+++ b/src/mongo/s/commands/get_shard_map_cmd.cpp
@@ -67,7 +67,7 @@ public:
}
bool run(OperationContext* opCtx,
- const std::string& dbname,
+ const DatabaseName&,
const BSONObj& cmdObj,
BSONObjBuilder& result) override {
auto const grid = Grid::get(opCtx);