summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-05-17 16:13:57 -0400
committerMathias Stearn <mathias@10gen.com>2017-05-17 19:29:36 -0400
commit9687c56dad047fb222076c0eb5fb25db6a796219 (patch)
treec3d197a64776090c57cd761d104f014ba8d2a8e8 /src/mongo
parent4ec8e7a515ceb3e87b64ddde624404d1c4498066 (diff)
downloadmongo-9687c56dad047fb222076c0eb5fb25db6a796219.tar.gz
SERVER-29260 Make BSONObj argument to Command::run() const&
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/auth/sasl_commands.cpp8
-rw-r--r--src/mongo/db/commands.h2
-rw-r--r--src/mongo/db/commands/apply_ops_cmd.cpp2
-rw-r--r--src/mongo/db/commands/authentication_commands.cpp6
-rw-r--r--src/mongo/db/commands/authentication_commands.h2
-rw-r--r--src/mongo/db/commands/clone.cpp2
-rw-r--r--src/mongo/db/commands/clone_collection.cpp2
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp4
-rw-r--r--src/mongo/db/commands/compact.cpp2
-rw-r--r--src/mongo/db/commands/conn_pool_stats.cpp2
-rw-r--r--src/mongo/db/commands/conn_pool_sync.cpp2
-rw-r--r--src/mongo/db/commands/connection_status.cpp2
-rw-r--r--src/mongo/db/commands/copydb.cpp2
-rw-r--r--src/mongo/db/commands/copydb_start_commands.cpp4
-rw-r--r--src/mongo/db/commands/count_cmd.cpp2
-rw-r--r--src/mongo/db/commands/cpuload.cpp2
-rw-r--r--src/mongo/db/commands/cpuprofile.cpp8
-rw-r--r--src/mongo/db/commands/create_indexes.cpp2
-rw-r--r--src/mongo/db/commands/current_op.cpp2
-rw-r--r--src/mongo/db/commands/dbcommands.cpp28
-rw-r--r--src/mongo/db/commands/dbhash.cpp2
-rw-r--r--src/mongo/db/commands/distinct.cpp2
-rw-r--r--src/mongo/db/commands/driverHelpers.cpp2
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp4
-rw-r--r--src/mongo/db/commands/eval.cpp2
-rw-r--r--src/mongo/db/commands/explain_cmd.cpp2
-rw-r--r--src/mongo/db/commands/fail_point_cmd.cpp2
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp2
-rw-r--r--src/mongo/db/commands/find_cmd.cpp2
-rw-r--r--src/mongo/db/commands/fsync.cpp4
-rw-r--r--src/mongo/db/commands/generic.cpp20
-rw-r--r--src/mongo/db/commands/geo_near_cmd.cpp2
-rw-r--r--src/mongo/db/commands/get_last_error.cpp6
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp4
-rw-r--r--src/mongo/db/commands/group_cmd.cpp2
-rw-r--r--src/mongo/db/commands/hashcmd.cpp2
-rw-r--r--src/mongo/db/commands/haystack.cpp2
-rw-r--r--src/mongo/db/commands/index_filter_commands.cpp8
-rw-r--r--src/mongo/db/commands/index_filter_commands.h10
-rw-r--r--src/mongo/db/commands/isself.cpp2
-rw-r--r--src/mongo/db/commands/kill_op.cpp2
-rw-r--r--src/mongo/db/commands/killcursors_common.cpp2
-rw-r--r--src/mongo/db/commands/killcursors_common.h2
-rw-r--r--src/mongo/db/commands/list_collections.cpp2
-rw-r--r--src/mongo/db/commands/list_databases.cpp2
-rw-r--r--src/mongo/db/commands/list_indexes.cpp2
-rw-r--r--src/mongo/db/commands/lock_info.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp4
-rw-r--r--src/mongo/db/commands/oplog_note.cpp2
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp2
-rw-r--r--src/mongo/db/commands/parameters.cpp4
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp2
-rw-r--r--src/mongo/db/commands/plan_cache_commands.cpp8
-rw-r--r--src/mongo/db/commands/plan_cache_commands.h10
-rw-r--r--src/mongo/db/commands/rename_collection_cmd.cpp2
-rw-r--r--src/mongo/db/commands/repair_cursor.cpp2
-rw-r--r--src/mongo/db/commands/server_status.cpp2
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp2
-rw-r--r--src/mongo/db/commands/snapshot_management.cpp4
-rw-r--r--src/mongo/db/commands/test_commands.cpp8
-rw-r--r--src/mongo/db/commands/top_command.cpp2
-rw-r--r--src/mongo/db/commands/touch.cpp2
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp40
-rw-r--r--src/mongo/db/commands/validate.cpp2
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.cpp2
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp2
-rw-r--r--src/mongo/db/ftdc/ftdc_commands.cpp2
-rw-r--r--src/mongo/db/repl/master_slave.cpp2
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp32
-rw-r--r--src/mongo/db/repl/repl_set_request_votes.cpp2
-rw-r--r--src/mongo/db/repl/replication_info.cpp2
-rw-r--r--src/mongo/db/repl/resync.cpp2
-rw-r--r--src/mongo/db/s/check_sharding_index_command.cpp2
-rw-r--r--src/mongo/db/s/cleanup_orphaned_cmd.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_control_balancer_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_merge_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_move_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_split_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp2
-rw-r--r--src/mongo/db/s/get_shard_version_command.cpp2
-rw-r--r--src/mongo/db/s/merge_chunks_command.cpp2
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp4
-rw-r--r--src/mongo/db/s/migration_destination_manager_legacy_commands.cpp8
-rw-r--r--src/mongo/db/s/move_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/set_shard_version_command.cpp2
-rw-r--r--src/mongo/db/s/sharding_state_command.cpp2
-rw-r--r--src/mongo/db/s/split_chunk_command.cpp2
-rw-r--r--src/mongo/db/s/split_vector_command.cpp2
-rw-r--r--src/mongo/db/s/unset_sharding_command.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp2
-rw-r--r--src/mongo/s/client/shard_connection.cpp2
-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_apply_ops_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_available_query_options_cmd.cpp2
-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_count_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_current_op.cpp2
-rw-r--r--src/mongo/s/commands/cluster_db_stats_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_drop_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_drop_database_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_enable_sharding_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_explain_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_find_and_modify_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_find_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_flush_router_config_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_fsync_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_ftdc_commands.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_last_error_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_prev_error_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_shard_map_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_get_shard_version_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_getmore_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_index_filter_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_is_db_grid_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_is_master_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_kill_op.cpp2
-rw-r--r--src/mongo/s/commands/cluster_list_databases_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_list_shards_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_map_reduce_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_merge_chunks_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_move_chunk_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_move_primary_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_netstat_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_pipeline_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_plan_cache_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_profile_cmd.cpp2
-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_repl_set_get_status_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_reset_error_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_shard_collection_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_shutdown_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_split_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_user_management_commands.cpp38
-rw-r--r--src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp2
-rw-r--r--src/mongo/s/commands/cluster_write_cmd.cpp2
-rw-r--r--src/mongo/s/commands/commands_public.cpp30
146 files changed, 274 insertions, 274 deletions
diff --git a/src/mongo/db/auth/sasl_commands.cpp b/src/mongo/db/auth/sasl_commands.cpp
index d311f174b6b..e0fad877a25 100644
--- a/src/mongo/db/auth/sasl_commands.cpp
+++ b/src/mongo/db/auth/sasl_commands.cpp
@@ -75,7 +75,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& ignored,
BSONObjBuilder& result);
@@ -102,7 +102,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& ignored,
BSONObjBuilder& result);
@@ -270,7 +270,7 @@ void CmdSaslStart::redactForLogging(mutablebson::Document* cmdObj) {
bool CmdSaslStart::run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& ignored,
BSONObjBuilder& result) {
Client* client = Client::getCurrent();
@@ -311,7 +311,7 @@ void CmdSaslContinue::help(std::stringstream& os) const {
bool CmdSaslContinue::run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& ignored,
BSONObjBuilder& result) {
Client* client = Client::getCurrent();
diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h
index d0f4d2bba25..a9bfc682712 100644
--- a/src/mongo/db/commands.h
+++ b/src/mongo/db/commands.h
@@ -124,7 +124,7 @@ public:
*/
virtual bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) = 0;
diff --git a/src/mongo/db/commands/apply_ops_cmd.cpp b/src/mongo/db/commands/apply_ops_cmd.cpp
index be1184edc62..9b142037601 100644
--- a/src/mongo/db/commands/apply_ops_cmd.cpp
+++ b/src/mongo/db/commands/apply_ops_cmd.cpp
@@ -87,7 +87,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
validateApplyOpsCommand(cmdObj);
diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp
index 438da755c30..58493790818 100644
--- a/src/mongo/db/commands/authentication_commands.cpp
+++ b/src/mongo/db/commands/authentication_commands.cpp
@@ -115,7 +115,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
nonce64 n = getNextNonce();
@@ -152,7 +152,7 @@ void CmdAuthenticate::redactForLogging(mutablebson::Document* cmdObj) {
bool CmdAuthenticate::run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (!serverGlobalParams.quiet.load()) {
@@ -375,7 +375,7 @@ public:
CmdLogout() : Command("logout") {}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
AuthorizationSession* authSession = AuthorizationSession::get(Client::getCurrent());
diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h
index e49c214091c..f6b0c66e147 100644
--- a/src/mongo/db/commands/authentication_commands.h
+++ b/src/mongo/db/commands/authentication_commands.h
@@ -57,7 +57,7 @@ public:
CmdAuthenticate() : Command("authenticate") {}
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result);
diff --git a/src/mongo/db/commands/clone.cpp b/src/mongo/db/commands/clone.cpp
index 68674aead43..14585aedcd4 100644
--- a/src/mongo/db/commands/clone.cpp
+++ b/src/mongo/db/commands/clone.cpp
@@ -89,7 +89,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
boost::optional<DisableDocumentValidation> maybeDisableValidation;
diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp
index f8aeb131026..c1ca464ea4c 100644
--- a/src/mongo/db/commands/clone_collection.cpp
+++ b/src/mongo/db/commands/clone_collection.cpp
@@ -105,7 +105,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
boost::optional<DisableDocumentValidation> maybeDisableValidation;
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index 62fab6dfe69..b749b2b1b23 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -86,7 +86,7 @@ public:
}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
const auto fromElt = jsobj["cloneCollectionAsCapped"];
@@ -170,7 +170,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, jsobj));
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index bd408337cc5..e7c914ef0c4 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -88,7 +88,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
NamespaceString nss = parseNsCollectionRequired(db, cmdObj);
diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp
index c3700b839bf..88a74cdbd30 100644
--- a/src/mongo/db/commands/conn_pool_stats.cpp
+++ b/src/mongo/db/commands/conn_pool_stats.cpp
@@ -71,7 +71,7 @@ public:
bool run(OperationContext* opCtx,
const std::string&,
- mongo::BSONObj&,
+ const mongo::BSONObj&,
std::string&,
mongo::BSONObjBuilder& result) override {
executor::ConnectionPoolStats stats{};
diff --git a/src/mongo/db/commands/conn_pool_sync.cpp b/src/mongo/db/commands/conn_pool_sync.cpp
index 602f6e8421d..32bdda9bffa 100644
--- a/src/mongo/db/commands/conn_pool_sync.cpp
+++ b/src/mongo/db/commands/conn_pool_sync.cpp
@@ -56,7 +56,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string&,
- mongo::BSONObj&,
+ const mongo::BSONObj&,
std::string&,
mongo::BSONObjBuilder& result) {
shardConnectionPool.flush();
diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp
index c21d1427414..10cd52c4815 100644
--- a/src/mongo/db/commands/connection_status.cpp
+++ b/src/mongo/db/commands/connection_status.cpp
@@ -57,7 +57,7 @@ public:
bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
AuthorizationSession* authSession = AuthorizationSession::get(Client::getCurrent());
diff --git a/src/mongo/db/commands/copydb.cpp b/src/mongo/db/commands/copydb.cpp
index 88ef6540e02..e0ab332ac04 100644
--- a/src/mongo/db/commands/copydb.cpp
+++ b/src/mongo/db/commands/copydb.cpp
@@ -117,7 +117,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
boost::optional<DisableDocumentValidation> maybeDisableValidation;
diff --git a/src/mongo/db/commands/copydb_start_commands.cpp b/src/mongo/db/commands/copydb_start_commands.cpp
index e028431cf71..24ebc9c695a 100644
--- a/src/mongo/db/commands/copydb_start_commands.cpp
+++ b/src/mongo/db/commands/copydb_start_commands.cpp
@@ -98,7 +98,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
string fromhost = cmdObj.getStringField("fromhost");
@@ -171,7 +171,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const auto fromdbElt = cmdObj["fromdb"];
diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp
index 2af91e01876..0003b2bf806 100644
--- a/src/mongo/db/commands/count_cmd.cpp
+++ b/src/mongo/db/commands/count_cmd.cpp
@@ -166,7 +166,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool isExplain = false;
diff --git a/src/mongo/db/commands/cpuload.cpp b/src/mongo/db/commands/cpuload.cpp
index 3ad635a57d7..f8ac54313e6 100644
--- a/src/mongo/db/commands/cpuload.cpp
+++ b/src/mongo/db/commands/cpuload.cpp
@@ -60,7 +60,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* txn,
const string& badns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
double cpuFactor = 1;
diff --git a/src/mongo/db/commands/cpuprofile.cpp b/src/mongo/db/commands/cpuprofile.cpp
index 8f9c16901fe..c5ec73204a9 100644
--- a/src/mongo/db/commands/cpuprofile.cpp
+++ b/src/mongo/db/commands/cpuprofile.cpp
@@ -105,7 +105,7 @@ public:
virtual bool run(OperationContext* opCtx,
std::string const& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result);
@@ -121,7 +121,7 @@ public:
virtual bool run(OperationContext* opCtx,
std::string const& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result);
@@ -133,7 +133,7 @@ char const* const CpuProfilerStopCommand::commandName = "_cpuProfilerStop";
bool CpuProfilerStartCommand::run(OperationContext* opCtx,
std::string const& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
// The DB lock here is just so we have IX on the global lock in order to prevent shutdown
@@ -150,7 +150,7 @@ bool CpuProfilerStartCommand::run(OperationContext* opCtx,
bool CpuProfilerStopCommand::run(OperationContext* opCtx,
std::string const& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
// The DB lock here is just so we have IX on the global lock in order to prevent shutdown
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index db71d3bebf5..77feecc13a0 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -227,7 +227,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString ns(parseNsCollectionRequired(dbname, cmdObj));
diff --git a/src/mongo/db/commands/current_op.cpp b/src/mongo/db/commands/current_op.cpp
index 3a86aaabf31..623610d3e66 100644
--- a/src/mongo/db/commands/current_op.cpp
+++ b/src/mongo/db/commands/current_op.cpp
@@ -87,7 +87,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
const bool includeAll = cmdObj["$all"].trueValue();
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index f41d6a2ae2b..e1383becee1 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -126,7 +126,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
bool force = cmdObj.hasField("force") && cmdObj["force"].trueValue();
@@ -175,7 +175,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
// disallow dropping the config database
@@ -243,7 +243,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
BSONElement e = cmdObj.firstElement();
@@ -346,7 +346,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
BSONElement firstElement = cmdObj.firstElement();
@@ -428,7 +428,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const char* deprecationWarning =
@@ -485,7 +485,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nsToDrop = parseNsCollectionRequired(dbname, cmdObj);
@@ -536,7 +536,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString ns(parseNsCollectionRequired(dbname, cmdObj));
@@ -677,7 +677,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNs(dbname, jsobj));
@@ -856,7 +856,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
Timer timer;
@@ -999,7 +999,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, jsobj));
@@ -1047,7 +1047,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, jsobj));
@@ -1082,7 +1082,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
int scale = 1;
@@ -1166,7 +1166,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
result << "you" << opCtx->getClient()->clientAddress(true /*includePort*/);
@@ -1192,7 +1192,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
result << "options" << QueryOption_AllSupported;
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 598fe1aad7c..5aaf0d382ca 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -80,7 +80,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Timer timer;
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index 6c2bef4012a..c1958e34f55 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -166,7 +166,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj));
diff --git a/src/mongo/db/commands/driverHelpers.cpp b/src/mongo/db/commands/driverHelpers.cpp
index 994eb54605c..ae169abd8b6 100644
--- a/src/mongo/db/commands/driverHelpers.cpp
+++ b/src/mongo/db/commands/driverHelpers.cpp
@@ -75,7 +75,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (cmdObj.firstElement().type() != jstOID) {
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index 0a78963ad1f..b8c6e5442cb 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -86,7 +86,7 @@ public:
CmdDropIndexes() : Command("dropIndexes", "deleteIndexes") {}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss = parseNsCollectionRequired(dbname, jsobj);
@@ -117,7 +117,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
DBDirectClient db(opCtx);
diff --git a/src/mongo/db/commands/eval.cpp b/src/mongo/db/commands/eval.cpp
index 3a11e45e11f..dbebb016e16 100644
--- a/src/mongo/db/commands/eval.cpp
+++ b/src/mongo/db/commands/eval.cpp
@@ -176,7 +176,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
// Note: 'eval' is not allowed to touch sharded namespaces, but we can't check the
diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp
index b62fe416ac7..e55da5b2974 100644
--- a/src/mongo/db/commands/explain_cmd.cpp
+++ b/src/mongo/db/commands/explain_cmd.cpp
@@ -122,7 +122,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto verbosity = ExplainOptions::parseCmdBSON(cmdObj);
diff --git a/src/mongo/db/commands/fail_point_cmd.cpp b/src/mongo/db/commands/fail_point_cmd.cpp
index ce8f1367f58..17d447550e5 100644
--- a/src/mongo/db/commands/fail_point_cmd.cpp
+++ b/src/mongo/db/commands/fail_point_cmd.cpp
@@ -92,7 +92,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const string failPointName(cmdObj.firstElement().str());
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index 5ec268571e5..01d5d70b584 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -337,7 +337,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
// findAndModify command is not replicated directly.
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index dc6640989f9..8c7759471ce 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -228,7 +228,7 @@ public:
*/
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNsOrUUID(opCtx, dbname, cmdObj));
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp
index 1a9b7628503..5359963d381 100644
--- a/src/mongo/db/commands/fsync.cpp
+++ b/src/mongo/db/commands/fsync.cpp
@@ -119,7 +119,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (opCtx->lockState()->isLocked()) {
@@ -292,7 +292,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
log() << "command: unlock requested";
diff --git a/src/mongo/db/commands/generic.cpp b/src/mongo/db/commands/generic.cpp
index 0a54dc74bbb..d520f59e2c6 100644
--- a/src/mongo/db/commands/generic.cpp
+++ b/src/mongo/db/commands/generic.cpp
@@ -91,7 +91,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
std::string& errmsg,
BSONObjBuilder& result) {
VersionInfoInterface::instance().appendBuildInfo(&result);
@@ -120,7 +120,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* opCtx,
const string& badns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
// IMPORTANT: Don't put anything in here that might lock db - including authentication
@@ -145,7 +145,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (getGlobalScriptEngine()) {
@@ -187,7 +187,7 @@ public:
}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
ProcessInfo p;
@@ -234,7 +234,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
bool didRotate = rotateLogs(serverGlobalParams.logRenameOnRotate);
@@ -265,7 +265,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
virtual bool run(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
// sort the commands before building the result BSON
@@ -363,7 +363,7 @@ public:
CmdForceError() : Command("forceerror") {}
bool run(OperationContext* opCtx,
const string& dbnamne,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
LastError::get(cc()).setLastError(10038, "forced error");
@@ -397,7 +397,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
BSONElement val = cmdObj.firstElement();
@@ -468,7 +468,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
std::string logName;
@@ -520,7 +520,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
result.append("argv", serverGlobalParams.argvArray);
diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp
index 65cf9a857dc..ce4f54a5790 100644
--- a/src/mongo/db/commands/geo_near_cmd.cpp
+++ b/src/mongo/db/commands/geo_near_cmd.cpp
@@ -100,7 +100,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (!cmdObj["start"].eoo()) {
diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp
index e153de58188..7196c363ec3 100644
--- a/src/mongo/db/commands/get_last_error.cpp
+++ b/src/mongo/db/commands/get_last_error.cpp
@@ -72,7 +72,7 @@ public:
CmdResetError() : Command("resetError", "reseterror") {}
bool run(OperationContext* opCtx,
const string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
LastError::get(opCtx->getClient()).reset();
@@ -105,7 +105,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
//
@@ -313,7 +313,7 @@ public:
CmdGetPrevError() : Command("getPrevError", "getpreverror") {}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
LastError* le = &LastError::get(opCtx->getClient());
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index de15131f3fd..59c2848313c 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -148,7 +148,7 @@ public:
bool runParsed(OperationContext* opCtx,
const NamespaceString& origNss,
const GetMoreRequest& request,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
@@ -443,7 +443,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
// Counted as a getMore, not as a command.
diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp
index ac17916ef31..45cd9c999ce 100644
--- a/src/mongo/db/commands/group_cmd.cpp
+++ b/src/mongo/db/commands/group_cmd.cpp
@@ -150,7 +150,7 @@ private:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
RARELY {
diff --git a/src/mongo/db/commands/hashcmd.cpp b/src/mongo/db/commands/hashcmd.cpp
index b47b2352650..a540cd771f0 100644
--- a/src/mongo/db/commands/hashcmd.cpp
+++ b/src/mongo/db/commands/hashcmd.cpp
@@ -81,7 +81,7 @@ public:
**/
bool run(OperationContext* opCtx,
const string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
result.appendAs(cmdObj.firstElement(), "key");
diff --git a/src/mongo/db/commands/haystack.cpp b/src/mongo/db/commands/haystack.cpp
index 77270437ff7..b2b7f9977b6 100644
--- a/src/mongo/db/commands/haystack.cpp
+++ b/src/mongo/db/commands/haystack.cpp
@@ -97,7 +97,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss = parseNsCollectionRequired(dbname, cmdObj);
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp
index 101294e4dde..42e9419622c 100644
--- a/src/mongo/db/commands/index_filter_commands.cpp
+++ b/src/mongo/db/commands/index_filter_commands.cpp
@@ -117,7 +117,7 @@ IndexFilterCommand::IndexFilterCommand(const string& name, const string& helpTex
bool IndexFilterCommand::run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj));
@@ -161,7 +161,7 @@ ListFilters::ListFilters()
Status ListFilters::runIndexFilterCommand(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) {
// This is a read lock. The query settings is owned by the collection.
AutoGetCollectionForReadCommand ctx(opCtx, NamespaceString(ns));
@@ -229,7 +229,7 @@ ClearFilters::ClearFilters()
Status ClearFilters::runIndexFilterCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) {
// This is a read lock. The query settings is owned by the collection.
AutoGetCollectionForReadCommand ctx(opCtx, NamespaceString(ns));
@@ -330,7 +330,7 @@ SetFilter::SetFilter()
Status SetFilter::runIndexFilterCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) {
// This is a read lock. The query settings is owned by the collection.
const NamespaceString nss(ns);
diff --git a/src/mongo/db/commands/index_filter_commands.h b/src/mongo/db/commands/index_filter_commands.h
index 9cedd30f765..27c81dbc6ba 100644
--- a/src/mongo/db/commands/index_filter_commands.h
+++ b/src/mongo/db/commands/index_filter_commands.h
@@ -65,7 +65,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result);
@@ -93,7 +93,7 @@ public:
*/
virtual Status runIndexFilterCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) = 0;
private:
@@ -112,7 +112,7 @@ public:
virtual Status runIndexFilterCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob);
/**
@@ -134,7 +134,7 @@ public:
virtual Status runIndexFilterCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob);
/**
@@ -168,7 +168,7 @@ public:
virtual Status runIndexFilterCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob);
/**
diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp
index bb1a023c7b5..014fb89ee2d 100644
--- a/src/mongo/db/commands/isself.cpp
+++ b/src/mongo/db/commands/isself.cpp
@@ -56,7 +56,7 @@ public:
std::vector<Privilege>* out) {} // No auth required
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
result.append("id", repl::instanceId);
diff --git a/src/mongo/db/commands/kill_op.cpp b/src/mongo/db/commands/kill_op.cpp
index 6a6d4603443..6edd8b8b4a8 100644
--- a/src/mongo/db/commands/kill_op.cpp
+++ b/src/mongo/db/commands/kill_op.cpp
@@ -130,7 +130,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
long long opId = parseOpId(cmdObj);
diff --git a/src/mongo/db/commands/killcursors_common.cpp b/src/mongo/db/commands/killcursors_common.cpp
index b20aeb3f734..eaa9ec51baf 100644
--- a/src/mongo/db/commands/killcursors_common.cpp
+++ b/src/mongo/db/commands/killcursors_common.cpp
@@ -65,7 +65,7 @@ Status KillCursorsCmdBase::checkAuthForCommand(Client* client,
bool KillCursorsCmdBase::run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto statusWithRequest = KillCursorsRequest::parseFromBSON(dbname, cmdObj);
diff --git a/src/mongo/db/commands/killcursors_common.h b/src/mongo/db/commands/killcursors_common.h
index 8d4bcf07c75..0944abd0468 100644
--- a/src/mongo/db/commands/killcursors_common.h
+++ b/src/mongo/db/commands/killcursors_common.h
@@ -72,7 +72,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final;
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index e9038a46cfd..b667dfcb092 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -220,7 +220,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
unique_ptr<MatchExpression> matcher;
diff --git a/src/mongo/db/commands/list_databases.cpp b/src/mongo/db/commands/list_databases.cpp
index d71d9ab3abb..4b96d386577 100644
--- a/src/mongo/db/commands/list_databases.cpp
+++ b/src/mongo/db/commands/list_databases.cpp
@@ -85,7 +85,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
// Parse the filter.
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index 6d58c8c2b47..0e639d07108 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -118,7 +118,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString ns(parseNsOrUUID(opCtx, dbname, cmdObj));
diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp
index 9318f734c9f..5a3c2dd5dab 100644
--- a/src/mongo/db/commands/lock_info.cpp
+++ b/src/mongo/db/commands/lock_info.cpp
@@ -81,7 +81,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) {
std::map<LockerId, BSONObj> lockToClientMap;
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index e4463ad7c1a..3cfb1ec4341 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -1375,7 +1375,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmd,
+ const BSONObj& cmd,
string& errmsg,
BSONObjBuilder& result) {
Timer t;
@@ -1710,7 +1710,7 @@ public:
}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index 9a5760d616a..371057a68fa 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -115,7 +115,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auto replCoord = repl::ReplicationCoordinator::get(opCtx);
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 41471f656aa..a81c9e3a4c5 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -87,7 +87,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString ns(parseNsCollectionRequired(dbname, cmdObj));
diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp
index 785375c514f..ab794c8bf0e 100644
--- a/src/mongo/db/commands/parameters.cpp
+++ b/src/mongo/db/commands/parameters.cpp
@@ -90,7 +90,7 @@ public:
}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
bool all = *cmdObj.firstElement().valuestrsafe() == '*';
@@ -138,7 +138,7 @@ public:
}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
int numSet = 0;
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 9f21d3825db..79a2e76270d 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -83,7 +83,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
return appendCommandStatus(result,
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp
index f194d17129e..c7ebdb034a1 100644
--- a/src/mongo/db/commands/plan_cache_commands.cpp
+++ b/src/mongo/db/commands/plan_cache_commands.cpp
@@ -112,7 +112,7 @@ PlanCacheCommand::PlanCacheCommand(const string& name,
bool PlanCacheCommand::run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj));
@@ -223,7 +223,7 @@ PlanCacheListQueryShapes::PlanCacheListQueryShapes()
Status PlanCacheListQueryShapes::runPlanCacheCommand(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) {
// This is a read lock. The query cache is owned by the collection.
AutoGetCollectionForReadCommand ctx(opCtx, NamespaceString(ns));
@@ -275,7 +275,7 @@ PlanCacheClear::PlanCacheClear()
Status PlanCacheClear::runPlanCacheCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) {
// This is a read lock. The query cache is owned by the collection.
AutoGetCollectionForReadCommand ctx(opCtx, NamespaceString(ns));
@@ -352,7 +352,7 @@ PlanCacheListPlans::PlanCacheListPlans()
Status PlanCacheListPlans::runPlanCacheCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) {
AutoGetCollectionForReadCommand ctx(opCtx, NamespaceString(ns));
diff --git a/src/mongo/db/commands/plan_cache_commands.h b/src/mongo/db/commands/plan_cache_commands.h
index 7b3da100782..8057aaaf95d 100644
--- a/src/mongo/db/commands/plan_cache_commands.h
+++ b/src/mongo/db/commands/plan_cache_commands.h
@@ -59,7 +59,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result);
@@ -87,7 +87,7 @@ public:
*/
virtual Status runPlanCacheCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob) = 0;
/**
@@ -113,7 +113,7 @@ public:
PlanCacheListQueryShapes();
virtual Status runPlanCacheCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob);
/**
@@ -139,7 +139,7 @@ public:
PlanCacheClear();
virtual Status runPlanCacheCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob);
/**
@@ -168,7 +168,7 @@ public:
PlanCacheListPlans();
virtual Status runPlanCacheCommand(OperationContext* opCtx,
const std::string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
BSONObjBuilder* bob);
/**
diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp
index 8a2afb4da64..9c4c027328c 100644
--- a/src/mongo/db/commands/rename_collection_cmd.cpp
+++ b/src/mongo/db/commands/rename_collection_cmd.cpp
@@ -87,7 +87,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const auto sourceNsElt = cmdObj[getName()];
diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp
index 031370f4316..5d644f78341 100644
--- a/src/mongo/db/commands/repair_cursor.cpp
+++ b/src/mongo/db/commands/repair_cursor.cpp
@@ -69,7 +69,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
NamespaceString ns(parseNs(dbname, cmdObj));
diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp
index 212498d178b..9edf5c43d16 100644
--- a/src/mongo/db/commands/server_status.cpp
+++ b/src/mongo/db/commands/server_status.cpp
@@ -87,7 +87,7 @@ public:
}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
_runCalled = true;
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
index 10234b925ba..7f01ef9ca5a 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -83,7 +83,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const auto version = uassertStatusOK(
diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp
index 05782177b9e..20b406b34fc 100644
--- a/src/mongo/db/commands/snapshot_management.cpp
+++ b/src/mongo/db/commands/snapshot_management.cpp
@@ -66,7 +66,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto snapshotManager =
@@ -115,7 +115,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto snapshotManager =
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 10016c71f0f..17cba2ee54a 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -77,7 +77,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj));
@@ -151,7 +151,7 @@ public:
CmdSleep() : Command("sleep") {}
bool run(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
log() << "test only command sleep invoked";
@@ -214,7 +214,7 @@ public:
std::vector<Privilege>* out) {}
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString fullNs = parseNsCollectionRequired(dbname, cmdObj);
@@ -291,7 +291,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss = parseNsCollectionRequired(dbname, cmdObj);
diff --git a/src/mongo/db/commands/top_command.cpp b/src/mongo/db/commands/top_command.cpp
index 8f306df9838..2b9c2e54671 100644
--- a/src/mongo/db/commands/top_command.cpp
+++ b/src/mongo/db/commands/top_command.cpp
@@ -67,7 +67,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
{
diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp
index 18c99460650..dbb6a2221af 100644
--- a/src/mongo/db/commands/touch.cpp
+++ b/src/mongo/db/commands/touch.cpp
@@ -84,7 +84,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss = parseNsCollectionRequired(dbname, cmdObj);
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index 8f147bc3baa..3126a71551d 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -618,7 +618,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::CreateOrUpdateUserArgs args;
@@ -764,7 +764,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::CreateOrUpdateUserArgs args;
@@ -881,7 +881,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
UserName userName;
@@ -949,7 +949,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = auth::parseAndValidateDropAllUsersFromDatabaseCommand(cmdObj, dbname);
@@ -1006,7 +1006,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
std::string userNameString;
@@ -1080,7 +1080,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
std::string userNameString;
@@ -1158,7 +1158,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::UsersInfoArgs args;
@@ -1270,7 +1270,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::CreateOrUpdateRoleArgs args;
@@ -1383,7 +1383,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::CreateOrUpdateRoleArgs args;
@@ -1481,7 +1481,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
@@ -1589,7 +1589,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
RoleName roleName;
@@ -1699,7 +1699,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
std::string roleNameString;
@@ -1790,7 +1790,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
std::string roleNameString;
@@ -1880,7 +1880,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
RoleName roleName;
@@ -2034,7 +2034,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = auth::parseDropAllRolesFromDatabaseCommand(cmdObj, dbname);
@@ -2177,7 +2177,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::RolesInfoArgs args;
@@ -2258,7 +2258,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
AuthorizationManager* authzManager = getGlobalAuthorizationManager();
@@ -2296,7 +2296,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
AuthorizationManager* authzManager = getGlobalAuthorizationManager();
@@ -2673,7 +2673,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::MergeAuthzCollectionsArgs args;
@@ -2914,7 +2914,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::AuthSchemaUpgradeArgs parsedArgs;
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index 11a0806fbf9..6b3e76286a7 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -77,7 +77,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (MONGO_FAIL_POINT(validateCmdCollectionNotValid)) {
diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp
index a3ecd02b36a..f9e17234607 100644
--- a/src/mongo/db/commands/write_commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands/write_commands.cpp
@@ -209,7 +209,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
try {
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index e9f2c255375..8beaaad2076 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -139,7 +139,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
BSONElement argElt = cmdObj["stageDebug"];
diff --git a/src/mongo/db/ftdc/ftdc_commands.cpp b/src/mongo/db/ftdc/ftdc_commands.cpp
index 23202624b60..5a20914982a 100644
--- a/src/mongo/db/ftdc/ftdc_commands.cpp
+++ b/src/mongo/db/ftdc/ftdc_commands.cpp
@@ -90,7 +90,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index 1e1ec17962c..cf0f351c12a 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -382,7 +382,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& ns,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
HandshakeArgs handshake;
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index b2ab4c3bc04..35a9ad9491c 100644
--- a/src/mongo/db/repl/repl_set_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
@@ -95,7 +95,7 @@ public:
CmdReplSetTest() : ReplSetCommand("replSetTest") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
log() << "replSetTest command received: " << cmdObj.toString();
@@ -163,7 +163,7 @@ public:
CmdReplSetGetRBID() : ReplSetCommand("replSetGetRBID") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -190,7 +190,7 @@ public:
CmdReplSetGetStatus() : ReplSetCommand("replSetGetStatus") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
if (cmdObj["forShell"].trueValue())
@@ -231,7 +231,7 @@ public:
CmdReplSetGetConfig() : ReplSetCommand("replSetGetConfig") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -330,7 +330,7 @@ public:
}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
BSONObj configObj;
@@ -404,7 +404,7 @@ public:
CmdReplSetReconfig() : ReplSetCommand("replSetReconfig") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -460,7 +460,7 @@ public:
CmdReplSetFreeze() : ReplSetCommand("replSetFreeze") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -491,7 +491,7 @@ public:
CmdReplSetStepDown() : ReplSetCommand("replSetStepDown") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -556,7 +556,7 @@ public:
CmdReplSetMaintenance() : ReplSetCommand("replSetMaintenance") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -584,7 +584,7 @@ public:
CmdReplSetSyncFrom() : ReplSetCommand("replSetSyncFrom") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -612,7 +612,7 @@ public:
CmdReplSetUpdatePosition() : ReplSetCommand("replSetUpdatePosition") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auto replCoord = repl::ReplicationCoordinator::get(opCtx->getClient()->getServiceContext());
@@ -711,7 +711,7 @@ public:
CmdReplSetHeartbeat() : ReplSetCommand("replSetHeartbeat") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
MONGO_FAIL_POINT_BLOCK(rsDelayHeartbeatResponse, delay) {
@@ -797,7 +797,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -829,7 +829,7 @@ public:
private:
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
DEV log() << "received elect msg " << cmdObj.toString();
@@ -862,7 +862,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
@@ -898,7 +898,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
diff --git a/src/mongo/db/repl/repl_set_request_votes.cpp b/src/mongo/db/repl/repl_set_request_votes.cpp
index 7c9ad65950b..7914e8aed01 100644
--- a/src/mongo/db/repl/repl_set_request_votes.cpp
+++ b/src/mongo/db/repl/repl_set_request_votes.cpp
@@ -49,7 +49,7 @@ public:
private:
bool run(OperationContext* opCtx,
const std::string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result);
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index dacefa5f72e..d91a80a58d9 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -233,7 +233,7 @@ public:
CmdIsMaster() : Command("isMaster", "ismaster") {}
virtual bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
/* currently request to arbiter is (somewhat arbitrarily) an ismaster request that is not
diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp
index d95ff87cc0f..e8876b47d4d 100644
--- a/src/mongo/db/repl/resync.cpp
+++ b/src/mongo/db/repl/resync.cpp
@@ -74,7 +74,7 @@ public:
CmdResync() : Command(kResyncFieldName) {}
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
bool waitForResync = !cmdObj.hasField(kWaitFieldName) || cmdObj[kWaitFieldName].trueValue();
diff --git a/src/mongo/db/s/check_sharding_index_command.cpp b/src/mongo/db/s/check_sharding_index_command.cpp
index e274dbaa7a9..4917050f219 100644
--- a/src/mongo/db/s/check_sharding_index_command.cpp
+++ b/src/mongo/db/s/check_sharding_index_command.cpp
@@ -84,7 +84,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
std::string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss = NamespaceString(parseNs(dbname, jsobj));
diff --git a/src/mongo/db/s/cleanup_orphaned_cmd.cpp b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
index 9327c1d551c..bf2b0046ca9 100644
--- a/src/mongo/db/s/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/s/cleanup_orphaned_cmd.cpp
@@ -205,7 +205,7 @@ public:
bool run(OperationContext* opCtx,
string const& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
string ns;
diff --git a/src/mongo/db/s/config/configsvr_add_shard_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
index d6584229b25..72dea07a677 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_command.cpp
@@ -88,7 +88,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp
index 0b1791846d5..d8cd89547ec 100644
--- a/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp
+++ b/src/mongo/db/s/config/configsvr_add_shard_to_zone_command.cpp
@@ -89,7 +89,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp
index 5da0f7f9467..9a42c25f634 100644
--- a/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp
+++ b/src/mongo/db/s/config/configsvr_commit_chunk_migration_command.cpp
@@ -119,7 +119,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
diff --git a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp
index 0abcd7ebd70..7a896693887 100644
--- a/src/mongo/db/s/config/configsvr_control_balancer_command.cpp
+++ b/src/mongo/db/s/config/configsvr_control_balancer_command.cpp
@@ -74,7 +74,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
uassert(ErrorCodes::InternalError,
diff --git a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp
index 5d0c6a1c125..9b57c172e86 100644
--- a/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_merge_chunk_command.cpp
@@ -100,7 +100,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/s/config/configsvr_move_chunk_command.cpp b/src/mongo/db/s/config/configsvr_move_chunk_command.cpp
index 857dc043d0c..efd4c4c8710 100644
--- a/src/mongo/db/s/config/configsvr_move_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_move_chunk_command.cpp
@@ -80,7 +80,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
auto request = uassertStatusOK(BalanceChunkRequest::parseFromConfigCommand(cmdObj));
diff --git a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp
index 59846797124..5228635a599 100644
--- a/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp
+++ b/src/mongo/db/s/config/configsvr_remove_shard_from_zone_command.cpp
@@ -89,7 +89,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp b/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp
index daba7456ed5..91e5ba98f2d 100644
--- a/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/s/config/configsvr_set_feature_compatibility_version_command.cpp
@@ -83,7 +83,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const auto version = uassertStatusOK(
diff --git a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
index ac7668c1a03..841e03a2a1e 100644
--- a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
@@ -98,7 +98,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp
index 2e253cf489e..f0b5328aedd 100644
--- a/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp
+++ b/src/mongo/db/s/config/configsvr_update_zone_key_range_command.cpp
@@ -91,7 +91,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& unusedDbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
if (serverGlobalParams.clusterRole != ClusterRole::ConfigServer) {
diff --git a/src/mongo/db/s/get_shard_version_command.cpp b/src/mongo/db/s/get_shard_version_command.cpp
index 68d7a4c70df..f1632fa7224 100644
--- a/src/mongo/db/s/get_shard_version_command.cpp
+++ b/src/mongo/db/s/get_shard_version_command.cpp
@@ -84,7 +84,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/db/s/merge_chunks_command.cpp b/src/mongo/db/s/merge_chunks_command.cpp
index 49bc379014a..6a3db0908ce 100644
--- a/src/mongo/db/s/merge_chunks_command.cpp
+++ b/src/mongo/db/s/merge_chunks_command.cpp
@@ -362,7 +362,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
uassertStatusOK(ShardingState::get(opCtx)->canAcceptShardedCommands());
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp
index d6cd3d89773..eeb12474948 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_commands.cpp
@@ -141,7 +141,7 @@ public:
bool run(OperationContext* opCtx,
const std::string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const MigrationSessionId migrationSessionId(
@@ -204,7 +204,7 @@ public:
bool run(OperationContext* opCtx,
const std::string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const MigrationSessionId migrationSessionId(
diff --git a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
index 383af210483..a188affcf43 100644
--- a/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
+++ b/src/mongo/db/s/migration_destination_manager_legacy_commands.cpp
@@ -86,7 +86,7 @@ public:
bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auto shardingState = ShardingState::get(opCtx);
@@ -186,7 +186,7 @@ public:
bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
ShardingState::get(opCtx)->migrationDestinationManager()->report(result);
@@ -226,7 +226,7 @@ public:
bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auto const sessionId = uassertStatusOK(MigrationSessionId::extractFromBSON(cmdObj));
@@ -273,7 +273,7 @@ public:
bool run(OperationContext* opCtx,
const string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auto const mdm = ShardingState::get(opCtx)->migrationDestinationManager();
diff --git a/src/mongo/db/s/move_chunk_command.cpp b/src/mongo/db/s/move_chunk_command.cpp
index 7f5500497d6..67edd9bb5af 100644
--- a/src/mongo/db/s/move_chunk_command.cpp
+++ b/src/mongo/db/s/move_chunk_command.cpp
@@ -114,7 +114,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
auto shardingState = ShardingState::get(opCtx);
diff --git a/src/mongo/db/s/set_shard_version_command.cpp b/src/mongo/db/s/set_shard_version_command.cpp
index 178a22596d2..618604f10b3 100644
--- a/src/mongo/db/s/set_shard_version_command.cpp
+++ b/src/mongo/db/s/set_shard_version_command.cpp
@@ -90,7 +90,7 @@ public:
bool run(OperationContext* opCtx,
const std::string&,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
uassert(ErrorCodes::IllegalOperation,
diff --git a/src/mongo/db/s/sharding_state_command.cpp b/src/mongo/db/s/sharding_state_command.cpp
index cf483e80c98..21b12746c9f 100644
--- a/src/mongo/db/s/sharding_state_command.cpp
+++ b/src/mongo/db/s/sharding_state_command.cpp
@@ -69,7 +69,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
ShardingState::get(opCtx)->appendInfo(opCtx, result);
diff --git a/src/mongo/db/s/split_chunk_command.cpp b/src/mongo/db/s/split_chunk_command.cpp
index 01e712cf95b..846d6ca4b87 100644
--- a/src/mongo/db/s/split_chunk_command.cpp
+++ b/src/mongo/db/s/split_chunk_command.cpp
@@ -169,7 +169,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
auto shardingState = ShardingState::get(opCtx);
diff --git a/src/mongo/db/s/split_vector_command.cpp b/src/mongo/db/s/split_vector_command.cpp
index 19f5951e616..309dddf1cfc 100644
--- a/src/mongo/db/s/split_vector_command.cpp
+++ b/src/mongo/db/s/split_vector_command.cpp
@@ -113,7 +113,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& jsobj,
+ const BSONObj& jsobj,
string& errmsg,
BSONObjBuilder& result) override {
//
diff --git a/src/mongo/db/s/unset_sharding_command.cpp b/src/mongo/db/s/unset_sharding_command.cpp
index d64b739f621..cb8e08a67b0 100644
--- a/src/mongo/db/s/unset_sharding_command.cpp
+++ b/src/mongo/db/s/unset_sharding_command.cpp
@@ -74,7 +74,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
ShardedConnectionInfo::reset(opCtx->getClient());
diff --git a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp
index 23e59a9f065..950276ac9ae 100644
--- a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp
+++ b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp
@@ -86,7 +86,7 @@ public:
std::vector<Privilege>* out) {}
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
boost::filesystem::path p = dur::getJournalDir();
diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp
index c7fe4d56f43..5e68edaebab 100644
--- a/src/mongo/s/client/shard_connection.cpp
+++ b/src/mongo/s/client/shard_connection.cpp
@@ -113,7 +113,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- mongo::BSONObj& cmdObj,
+ const mongo::BSONObj& cmdObj,
std::string& errmsg,
mongo::BSONObjBuilder& result) {
// Connection information
diff --git a/src/mongo/s/commands/cluster_add_shard_cmd.cpp b/src/mongo/s/commands/cluster_add_shard_cmd.cpp
index 15b20ae43e2..d85a4574f5c 100644
--- a/src/mongo/s/commands/cluster_add_shard_cmd.cpp
+++ b/src/mongo/s/commands/cluster_add_shard_cmd.cpp
@@ -82,7 +82,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
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 a6981ccbaab..87e5db92d95 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
@@ -98,7 +98,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto parsedRequest = uassertStatusOK(AddShardToZoneRequest::parseFromMongosCommand(cmdObj));
diff --git a/src/mongo/s/commands/cluster_apply_ops_cmd.cpp b/src/mongo/s/commands/cluster_apply_ops_cmd.cpp
index fd15a41f11f..25465129a2d 100644
--- a/src/mongo/s/commands/cluster_apply_ops_cmd.cpp
+++ b/src/mongo/s/commands/cluster_apply_ops_cmd.cpp
@@ -58,7 +58,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
uasserted(ErrorCodes::CommandNotSupported, "applyOps not allowed through mongos");
diff --git a/src/mongo/s/commands/cluster_available_query_options_cmd.cpp b/src/mongo/s/commands/cluster_available_query_options_cmd.cpp
index 8db71cb997b..4acb791fee1 100644
--- a/src/mongo/s/commands/cluster_available_query_options_cmd.cpp
+++ b/src/mongo/s/commands/cluster_available_query_options_cmd.cpp
@@ -55,7 +55,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
result << "options" << QueryOption_AllSupportedForSharding;
diff --git a/src/mongo/s/commands/cluster_compact_cmd.cpp b/src/mongo/s/commands/cluster_compact_cmd.cpp
index ab0607ed626..deaa852c25a 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,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
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 36a6a817620..268b80e5a8d 100644
--- a/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
+++ b/src/mongo/s/commands/cluster_control_balancer_cmd.cpp
@@ -79,7 +79,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
diff --git a/src/mongo/s/commands/cluster_count_cmd.cpp b/src/mongo/s/commands/cluster_count_cmd.cpp
index 9f5d842fce9..e4f9a99a7ef 100644
--- a/src/mongo/s/commands/cluster_count_cmd.cpp
+++ b/src/mongo/s/commands/cluster_count_cmd.cpp
@@ -73,7 +73,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/s/commands/cluster_current_op.cpp b/src/mongo/s/commands/cluster_current_op.cpp
index 009fb1d9ae2..69a4198abeb 100644
--- a/src/mongo/s/commands/cluster_current_op.cpp
+++ b/src/mongo/s/commands/cluster_current_op.cpp
@@ -82,7 +82,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& output) override {
auto shardResponses =
diff --git a/src/mongo/s/commands/cluster_db_stats_cmd.cpp b/src/mongo/s/commands/cluster_db_stats_cmd.cpp
index f89e54365ef..9e101dd4ff0 100644
--- a/src/mongo/s/commands/cluster_db_stats_cmd.cpp
+++ b/src/mongo/s/commands/cluster_db_stats_cmd.cpp
@@ -65,7 +65,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& output) override {
auto shardResponses =
diff --git a/src/mongo/s/commands/cluster_drop_cmd.cpp b/src/mongo/s/commands/cluster_drop_cmd.cpp
index 20a2932ca8d..bb7508c9194 100644
--- a/src/mongo/s/commands/cluster_drop_cmd.cpp
+++ b/src/mongo/s/commands/cluster_drop_cmd.cpp
@@ -73,7 +73,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj));
diff --git a/src/mongo/s/commands/cluster_drop_database_cmd.cpp b/src/mongo/s/commands/cluster_drop_database_cmd.cpp
index 5d88ed0fa2e..9a1dacd7539 100644
--- a/src/mongo/s/commands/cluster_drop_database_cmd.cpp
+++ b/src/mongo/s/commands/cluster_drop_database_cmd.cpp
@@ -72,7 +72,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
uassert(ErrorCodes::IllegalOperation,
diff --git a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
index f3e9b7368e5..a30686735d8 100644
--- a/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
+++ b/src/mongo/s/commands/cluster_enable_sharding_cmd.cpp
@@ -88,7 +88,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname_unused,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const std::string dbname = parseNs("", cmdObj);
diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp
index 102609e18d9..2fa4184a5c0 100644
--- a/src/mongo/s/commands/cluster_explain_cmd.cpp
+++ b/src/mongo/s/commands/cluster_explain_cmd.cpp
@@ -107,7 +107,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto verbosity = ExplainOptions::parseCmdBSON(cmdObj);
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 225567b3ebd..3e9054027e1 100644
--- a/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp
+++ b/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp
@@ -156,7 +156,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss = parseNsCollectionRequired(dbName, cmdObj);
diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp
index 80e9508ae55..16c84ab5c27 100644
--- a/src/mongo/s/commands/cluster_find_cmd.cpp
+++ b/src/mongo/s/commands/cluster_find_cmd.cpp
@@ -151,7 +151,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
// We count find command as a query op.
diff --git a/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp b/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp
index 5d36aba4723..30e7d6eb423 100644
--- a/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp
+++ b/src/mongo/s/commands/cluster_flush_router_config_cmd.cpp
@@ -66,7 +66,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
Grid::get(opCtx)->catalogCache()->purgeAllDatabases();
diff --git a/src/mongo/s/commands/cluster_fsync_cmd.cpp b/src/mongo/s/commands/cluster_fsync_cmd.cpp
index 28b907a061d..69177cfb1a1 100644
--- a/src/mongo/s/commands/cluster_fsync_cmd.cpp
+++ b/src/mongo/s/commands/cluster_fsync_cmd.cpp
@@ -69,7 +69,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
if (cmdObj["lock"].trueValue()) {
diff --git a/src/mongo/s/commands/cluster_ftdc_commands.cpp b/src/mongo/s/commands/cluster_ftdc_commands.cpp
index 9a29384298b..f097353d1dc 100644
--- a/src/mongo/s/commands/cluster_ftdc_commands.cpp
+++ b/src/mongo/s/commands/cluster_ftdc_commands.cpp
@@ -72,7 +72,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
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 39eb26a61f6..a54c380a685 100644
--- a/src/mongo/s/commands/cluster_get_last_error_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_last_error_cmd.cpp
@@ -208,7 +208,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
// Mongos GLE - finicky.
diff --git a/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp b/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp
index 97d96e3e322..7fdcfdb80f1 100644
--- a/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_prev_error_cmd.cpp
@@ -63,7 +63,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
errmsg += "getpreverror not supported for sharded environments";
diff --git a/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
index 69c9ee9f1dc..0917bdb90b2 100644
--- a/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
@@ -69,7 +69,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
// MongoD instances do not know that they are part of a sharded cluster until they
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 5280fdb44c3..d5b627b5de5 100644
--- a/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_shard_version_cmd.cpp
@@ -81,7 +81,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/s/commands/cluster_getmore_cmd.cpp b/src/mongo/s/commands/cluster_getmore_cmd.cpp
index 8d01a481f11..344841075e5 100644
--- a/src/mongo/s/commands/cluster_getmore_cmd.cpp
+++ b/src/mongo/s/commands/cluster_getmore_cmd.cpp
@@ -93,7 +93,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
// Counted as a getMore, not as a command.
diff --git a/src/mongo/s/commands/cluster_index_filter_cmd.cpp b/src/mongo/s/commands/cluster_index_filter_cmd.cpp
index 73f1f9cfe0f..e96ccec8822 100644
--- a/src/mongo/s/commands/cluster_index_filter_cmd.cpp
+++ b/src/mongo/s/commands/cluster_index_filter_cmd.cpp
@@ -93,7 +93,7 @@ public:
// Cluster plan cache command entry point.
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNs(dbname, cmdObj));
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 57e7b579e41..07527f725c3 100644
--- a/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_db_grid_cmd.cpp
@@ -54,7 +54,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
result.append("isdbgrid", 1);
diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp
index afda930a308..1c1be0b9a53 100644
--- a/src/mongo/s/commands/cluster_is_master_cmd.cpp
+++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp
@@ -69,7 +69,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
diff --git a/src/mongo/s/commands/cluster_kill_op.cpp b/src/mongo/s/commands/cluster_kill_op.cpp
index 653a19a152d..470031073c9 100644
--- a/src/mongo/s/commands/cluster_kill_op.cpp
+++ b/src/mongo/s/commands/cluster_kill_op.cpp
@@ -78,7 +78,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& db,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) final {
// The format of op is shardid:opid
diff --git a/src/mongo/s/commands/cluster_list_databases_cmd.cpp b/src/mongo/s/commands/cluster_list_databases_cmd.cpp
index e856bad19b3..68c9cd55581 100644
--- a/src/mongo/s/commands/cluster_list_databases_cmd.cpp
+++ b/src/mongo/s/commands/cluster_list_databases_cmd.cpp
@@ -85,7 +85,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname_unused,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const bool nameOnly = cmdObj["nameOnly"].trueValue();
diff --git a/src/mongo/s/commands/cluster_list_shards_cmd.cpp b/src/mongo/s/commands/cluster_list_shards_cmd.cpp
index 0487aefdf7f..d9ca47830fc 100644
--- a/src/mongo/s/commands/cluster_list_shards_cmd.cpp
+++ b/src/mongo/s/commands/cluster_list_shards_cmd.cpp
@@ -70,7 +70,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto shardsStatus = grid.catalogClient(opCtx)->getAllShards(
diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp
index 8a7ab425ae1..444a37e3b38 100644
--- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp
+++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp
@@ -178,7 +178,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
Timer t;
diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp
index 37c0bfeba59..c4ec3a5e2bb 100644
--- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp
+++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp
@@ -101,7 +101,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
index 6b289532d86..06659861cc7 100644
--- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
+++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp
@@ -97,7 +97,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
Timer t;
diff --git a/src/mongo/s/commands/cluster_move_primary_cmd.cpp b/src/mongo/s/commands/cluster_move_primary_cmd.cpp
index aeafb592e7b..1d1c6b364cc 100644
--- a/src/mongo/s/commands/cluster_move_primary_cmd.cpp
+++ b/src/mongo/s/commands/cluster_move_primary_cmd.cpp
@@ -102,7 +102,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname_unused,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const string dbname = parseNs("", cmdObj);
diff --git a/src/mongo/s/commands/cluster_netstat_cmd.cpp b/src/mongo/s/commands/cluster_netstat_cmd.cpp
index cffd4605833..61d19c1f408 100644
--- a/src/mongo/s/commands/cluster_netstat_cmd.cpp
+++ b/src/mongo/s/commands/cluster_netstat_cmd.cpp
@@ -67,7 +67,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
result.append("configserver",
diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp
index 25bee7dc634..83df03ca48e 100644
--- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp
+++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp
@@ -68,7 +68,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
return appendCommandStatus(result,
diff --git a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp
index 87beef74b24..105dd44f746 100644
--- a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp
+++ b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp
@@ -88,7 +88,7 @@ public:
// Cluster plan cache command entry point.
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result);
@@ -111,7 +111,7 @@ private:
bool ClusterPlanCacheCmd::run(OperationContext* opCtx,
const std::string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errMsg,
BSONObjBuilder& result) {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));
diff --git a/src/mongo/s/commands/cluster_profile_cmd.cpp b/src/mongo/s/commands/cluster_profile_cmd.cpp
index 5b4197062e8..9927ba08a65 100644
--- a/src/mongo/s/commands/cluster_profile_cmd.cpp
+++ b/src/mongo/s/commands/cluster_profile_cmd.cpp
@@ -60,7 +60,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
errmsg = "profile currently not supported via mongos";
diff --git a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp
index c3f819856e9..96376ad2702 100644
--- a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp
+++ b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp
@@ -81,7 +81,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
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 cfd072b88ef..26ba207131b 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
@@ -105,7 +105,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto parsedRequest =
diff --git a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp
index 66c7f6722d8..8dbb0411d14 100644
--- a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp
+++ b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp
@@ -66,7 +66,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
if (cmdObj["forShell"].trueValue()) {
diff --git a/src/mongo/s/commands/cluster_reset_error_cmd.cpp b/src/mongo/s/commands/cluster_reset_error_cmd.cpp
index e013c474e7e..7844ac44a27 100644
--- a/src/mongo/s/commands/cluster_reset_error_cmd.cpp
+++ b/src/mongo/s/commands/cluster_reset_error_cmd.cpp
@@ -61,7 +61,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
LastError::get(cc()).reset();
diff --git a/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp b/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp
index 271ceb7faee..9782f1f05bf 100644
--- a/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp
+++ b/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp
@@ -85,7 +85,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
const auto version = uassertStatusOK(
diff --git a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
index a4f7519f176..1d0a1970c75 100644
--- a/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
+++ b/src/mongo/s/commands/cluster_shard_collection_cmd.cpp
@@ -159,7 +159,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbname, cmdObj));
diff --git a/src/mongo/s/commands/cluster_shutdown_cmd.cpp b/src/mongo/s/commands/cluster_shutdown_cmd.cpp
index f429afef8c2..fde7564a285 100644
--- a/src/mongo/s/commands/cluster_shutdown_cmd.cpp
+++ b/src/mongo/s/commands/cluster_shutdown_cmd.cpp
@@ -43,7 +43,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
// Never returns
diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp
index 01f2b8430e3..4e18ab31d9a 100644
--- a/src/mongo/s/commands/cluster_split_cmd.cpp
+++ b/src/mongo/s/commands/cluster_split_cmd.cpp
@@ -125,7 +125,7 @@ public:
bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbname, cmdObj));
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 56647dff7ef..c27f6f78a02 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
@@ -120,7 +120,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
auto parsedRequest =
diff --git a/src/mongo/s/commands/cluster_user_management_commands.cpp b/src/mongo/s/commands/cluster_user_management_commands.cpp
index 7a569094447..dfa2233c57f 100644
--- a/src/mongo/s/commands/cluster_user_management_commands.cpp
+++ b/src/mongo/s/commands/cluster_user_management_commands.cpp
@@ -88,7 +88,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
return Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -126,7 +126,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
auth::CreateOrUpdateUserArgs args;
@@ -175,7 +175,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
UserName userName;
@@ -220,7 +220,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -260,7 +260,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
string userNameString;
@@ -307,7 +307,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
string userNameString;
@@ -358,7 +358,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
return Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementReadCommand(
@@ -392,7 +392,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
return Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -426,7 +426,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -466,7 +466,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -506,7 +506,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -546,7 +546,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -586,7 +586,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -629,7 +629,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -673,7 +673,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
const bool ok = Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -717,7 +717,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
return Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementReadCommand(
@@ -755,7 +755,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
AuthorizationManager* authzManager = getGlobalAuthorizationManager();
@@ -805,7 +805,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
return Grid::get(opCtx)->catalogClient(opCtx)->runUserManagementWriteCommand(
@@ -894,7 +894,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
// Run the authSchemaUpgrade command on the config servers
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 9ca29ed3d7d..207a30c38ee 100644
--- a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp
+++ b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp
@@ -59,7 +59,7 @@ public:
virtual bool run(OperationContext* opCtx,
const std::string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) {
result << "you" << cc().getRemote().toString();
diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp
index 96d40270a32..7569deb9504 100644
--- a/src/mongo/s/commands/cluster_write_cmd.cpp
+++ b/src/mongo/s/commands/cluster_write_cmd.cpp
@@ -129,7 +129,7 @@ public:
virtual bool run(OperationContext* opCtx,
const string& dbname,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) {
BatchedCommandRequest request(_writeType);
diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp
index f9b72616638..a946334b517 100644
--- a/src/mongo/s/commands/commands_public.cpp
+++ b/src/mongo/s/commands/commands_public.cpp
@@ -212,7 +212,7 @@ protected:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& output) override {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));
@@ -246,7 +246,7 @@ protected:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbName, cmdObj));
@@ -352,7 +352,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& output) {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));
@@ -423,7 +423,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
uassertStatusOK(createShardDatabase(opCtx, dbName));
@@ -455,7 +455,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const auto fullNsFromElt = cmdObj.firstElement();
@@ -513,7 +513,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const auto todbElt = cmdObj["todb"];
@@ -586,7 +586,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));
@@ -766,7 +766,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbName, cmdObj));
@@ -959,7 +959,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const std::string ns = parseNs(dbName, cmdObj);
@@ -994,7 +994,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));
@@ -1240,7 +1240,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNs(dbName, cmdObj));
@@ -1382,7 +1382,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));
@@ -1519,7 +1519,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) override {
RARELY {
@@ -1564,7 +1564,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) final {
auto nss = NamespaceString::makeListCollectionsNSS(dbName);
@@ -1613,7 +1613,7 @@ public:
bool run(OperationContext* opCtx,
const string& dbName,
- BSONObj& cmdObj,
+ const BSONObj& cmdObj,
string& errmsg,
BSONObjBuilder& result) final {
const NamespaceString nss(parseNsCollectionRequired(dbName, cmdObj));