diff options
Diffstat (limited to 'src/mongo/db/commands')
64 files changed, 261 insertions, 346 deletions
diff --git a/src/mongo/db/commands/apply_ops_cmd.cpp b/src/mongo/db/commands/apply_ops_cmd.cpp index ca0266908dd..caa6ec4c319 100644 --- a/src/mongo/db/commands/apply_ops_cmd.cpp +++ b/src/mongo/db/commands/apply_ops_cmd.cpp @@ -61,9 +61,9 @@ using std::stringstream; namespace { -class ApplyOpsCmd : public BasicCommand { +class ApplyOpsCmd : public ErrmsgCommandDeprecated { public: - ApplyOpsCmd() : BasicCommand("applyOps") {} + ApplyOpsCmd() : ErrmsgCommandDeprecated("applyOps") {} virtual bool slaveOk() const { return false; @@ -85,11 +85,11 @@ public: return checkAuthForApplyOpsCommand(opCtx, dbname, cmdObj); } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { validateApplyOpsCommand(cmdObj); boost::optional<DisableDocumentValidation> maybeDisableValidation; diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp index c7e6d1160aa..4c088f97493 100644 --- a/src/mongo/db/commands/authentication_commands.cpp +++ b/src/mongo/db/commands/authentication_commands.cpp @@ -116,7 +116,6 @@ public: bool run(OperationContext* opCtx, const string&, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { nonce64 n = getNextNonce(); stringstream ss; @@ -153,7 +152,6 @@ void CmdAuthenticate::redactForLogging(mutablebson::Document* cmdObj) { bool CmdAuthenticate::run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { if (!serverGlobalParams.quiet.load()) { mutablebson::Document cmdToLog(cmdObj, mutablebson::Document::kInPlaceDisabled); @@ -378,7 +376,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { AuthorizationSession* authSession = AuthorizationSession::get(Client::getCurrent()); authSession->logoutDatabase(dbname); diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h index 5bb01ad9fae..bbb837e4015 100644 --- a/src/mongo/db/commands/authentication_commands.h +++ b/src/mongo/db/commands/authentication_commands.h @@ -58,7 +58,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result); private: diff --git a/src/mongo/db/commands/clone.cpp b/src/mongo/db/commands/clone.cpp index 97744cedf86..f219a374778 100644 --- a/src/mongo/db/commands/clone.cpp +++ b/src/mongo/db/commands/clone.cpp @@ -90,7 +90,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { boost::optional<DisableDocumentValidation> maybeDisableValidation; if (shouldBypassDocumentValidationForCommand(cmdObj)) { diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp index 3eea32aa1fc..0ec44950793 100644 --- a/src/mongo/db/commands/clone_collection.cpp +++ b/src/mongo/db/commands/clone_collection.cpp @@ -59,9 +59,9 @@ using std::string; using std::stringstream; using std::endl; -class CmdCloneCollection : public BasicCommand { +class CmdCloneCollection : public ErrmsgCommandDeprecated { public: - CmdCloneCollection() : BasicCommand("cloneCollection") {} + CmdCloneCollection() : ErrmsgCommandDeprecated("cloneCollection") {} virtual bool slaveOk() const { return false; @@ -103,11 +103,11 @@ public: "is placed at the same db.collection (namespace) as the source.\n"; } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { boost::optional<DisableDocumentValidation> maybeDisableValidation; if (shouldBypassDocumentValidationForCommand(cmdObj)) maybeDisableValidation.emplace(opCtx); diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index 6a56cbaf144..55272f941a0 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -49,9 +49,9 @@ using std::unique_ptr; using std::string; using std::stringstream; -class CmdCloneCollectionAsCapped : public BasicCommand { +class CmdCloneCollectionAsCapped : public ErrmsgCommandDeprecated { public: - CmdCloneCollectionAsCapped() : BasicCommand("cloneCollectionAsCapped") {} + CmdCloneCollectionAsCapped() : ErrmsgCommandDeprecated("cloneCollectionAsCapped") {} virtual bool slaveOk() const { return false; } @@ -84,11 +84,11 @@ public: out->push_back(Privilege(ResourcePattern::forExactNamespace(nss), targetActions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& jsobj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& jsobj, + string& errmsg, + BSONObjBuilder& result) { const auto fromElt = jsobj["cloneCollectionAsCapped"]; const auto toElt = jsobj["toCollection"]; @@ -148,9 +148,9 @@ public: This command is not highly used, and is not currently supported with sharded environments. */ -class CmdConvertToCapped : public BasicCommand { +class CmdConvertToCapped : public ErrmsgCommandDeprecated { public: - CmdConvertToCapped() : BasicCommand("convertToCapped") {} + CmdConvertToCapped() : ErrmsgCommandDeprecated("convertToCapped") {} virtual bool slaveOk() const { return false; } @@ -168,11 +168,11 @@ public: out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& jsobj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& jsobj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, jsobj)); double size = jsobj.getField("size").number(); diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp index 492b9c46184..780790bb994 100644 --- a/src/mongo/db/commands/compact.cpp +++ b/src/mongo/db/commands/compact.cpp @@ -53,7 +53,7 @@ namespace mongo { using std::string; using std::stringstream; -class CompactCmd : public BasicCommand { +class CompactCmd : public ErrmsgCommandDeprecated { public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; @@ -84,13 +84,13 @@ public: " validate - check records are noncorrupt before adding to newly compacting " "extents. slower but safer (defaults to true in this version)\n"; } - CompactCmd() : BasicCommand("compact") {} + CompactCmd() : ErrmsgCommandDeprecated("compact") {} - virtual bool run(OperationContext* opCtx, - const string& db, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& db, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { NamespaceString nss = parseNsCollectionRequired(db, cmdObj); repl::ReplicationCoordinator* replCoord = repl::getGlobalReplicationCoordinator(); diff --git a/src/mongo/db/commands/conn_pool_stats.cpp b/src/mongo/db/commands/conn_pool_stats.cpp index 55047a55109..119712ce811 100644 --- a/src/mongo/db/commands/conn_pool_stats.cpp +++ b/src/mongo/db/commands/conn_pool_stats.cpp @@ -76,7 +76,6 @@ public: bool run(OperationContext* opCtx, const std::string& db, const mongo::BSONObj& cmdObj, - std::string& errmsg, 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 b1ce5b26dcf..c5831277334 100644 --- a/src/mongo/db/commands/conn_pool_sync.cpp +++ b/src/mongo/db/commands/conn_pool_sync.cpp @@ -57,7 +57,6 @@ public: virtual bool run(OperationContext* opCtx, const std::string&, const mongo::BSONObj&, - std::string&, mongo::BSONObjBuilder& result) { shardConnectionPool.flush(); globalConnPool.flush(); diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp index 9454b8769b4..b8ea2e101fd 100644 --- a/src/mongo/db/commands/connection_status.cpp +++ b/src/mongo/db/commands/connection_status.cpp @@ -58,7 +58,6 @@ public: bool run(OperationContext* opCtx, const string&, 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 4755d032916..0695a60382e 100644 --- a/src/mongo/db/commands/copydb.cpp +++ b/src/mongo/db/commands/copydb.cpp @@ -87,9 +87,9 @@ using std::stringstream; * NOTE: Since internal cluster auth works differently, "copydb" currently doesn't work between * shards in a cluster when auth is enabled. See SERVER-13080. */ -class CmdCopyDb : public BasicCommand { +class CmdCopyDb : public ErrmsgCommandDeprecated { public: - CmdCopyDb() : BasicCommand("copydb") {} + CmdCopyDb() : ErrmsgCommandDeprecated("copydb") {} virtual bool adminOnly() const { return true; @@ -115,11 +115,11 @@ public: << "[, slaveOk: <bool>, username: <username>, nonce: <nonce>, key: <key>]}"; } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { boost::optional<DisableDocumentValidation> maybeDisableValidation; if (shouldBypassDocumentValidationForCommand(cmdObj)) maybeDisableValidation.emplace(opCtx); diff --git a/src/mongo/db/commands/copydb_start_commands.cpp b/src/mongo/db/commands/copydb_start_commands.cpp index fbb3d485180..d537d621977 100644 --- a/src/mongo/db/commands/copydb_start_commands.cpp +++ b/src/mongo/db/commands/copydb_start_commands.cpp @@ -68,9 +68,9 @@ std::unique_ptr<DBClientBase>& CopyDbAuthConnection::forClient(Client* client) { * nonce from the source of a "copydb" operation for authentication purposes. See the * description of the "copydb" command below. */ -class CmdCopyDbGetNonce : public BasicCommand { +class CmdCopyDbGetNonce : public ErrmsgCommandDeprecated { public: - CmdCopyDbGetNonce() : BasicCommand("copydbgetnonce") {} + CmdCopyDbGetNonce() : ErrmsgCommandDeprecated("copydbgetnonce") {} virtual bool adminOnly() const { return true; @@ -96,11 +96,11 @@ public: help << "usage: {copydbgetnonce: 1, fromhost: <hostname>}"; } - virtual bool run(OperationContext* opCtx, - const string&, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string&, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { string fromhost = cmdObj.getStringField("fromhost"); if (fromhost.empty()) { /* copy from self */ @@ -140,9 +140,9 @@ public: * Run against the mongod that is the intended target for the "copydb" command. Used to * initialize a SASL auth session for a "copydb" operation for authentication purposes. */ -class CmdCopyDbSaslStart : public BasicCommand { +class CmdCopyDbSaslStart : public ErrmsgCommandDeprecated { public: - CmdCopyDbSaslStart() : BasicCommand("copydbsaslstart") {} + CmdCopyDbSaslStart() : ErrmsgCommandDeprecated("copydbsaslstart") {} virtual bool adminOnly() const { return true; @@ -169,11 +169,11 @@ public: "from secure server\n"; } - virtual bool run(OperationContext* opCtx, - const string&, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string&, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const auto fromdbElt = cmdObj["fromdb"]; uassert(ErrorCodes::TypeMismatch, "'renameCollection' must be of type String", diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp index dcd60503a80..199c3e0be9b 100644 --- a/src/mongo/db/commands/count_cmd.cpp +++ b/src/mongo/db/commands/count_cmd.cpp @@ -158,7 +158,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const bool isExplain = false; auto request = CountRequest::parseFromBSON(dbname, cmdObj, isExplain); diff --git a/src/mongo/db/commands/cpuload.cpp b/src/mongo/db/commands/cpuload.cpp index 996b6e11b46..51192715b1a 100644 --- a/src/mongo/db/commands/cpuload.cpp +++ b/src/mongo/db/commands/cpuload.cpp @@ -61,7 +61,6 @@ public: virtual bool run(OperationContext* txn, const string& badns, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { double cpuFactor = 1; if (cmdObj["cpuFactor"].isNumber()) { diff --git a/src/mongo/db/commands/cpuprofile.cpp b/src/mongo/db/commands/cpuprofile.cpp index 0586c646156..3d2ecc5da4f 100644 --- a/src/mongo/db/commands/cpuprofile.cpp +++ b/src/mongo/db/commands/cpuprofile.cpp @@ -68,9 +68,9 @@ namespace { /** * Common code for the implementation of cpu profiler commands. */ -class CpuProfilerCommand : public BasicCommand { +class CpuProfilerCommand : public ErrmsgCommandDeprecated { public: - CpuProfilerCommand(char const* name) : BasicCommand(name) {} + CpuProfilerCommand(char const* name) : ErrmsgCommandDeprecated(name) {} virtual bool slaveOk() const { return true; } @@ -103,11 +103,11 @@ class CpuProfilerStartCommand : public CpuProfilerCommand { public: CpuProfilerStartCommand() : CpuProfilerCommand(commandName) {} - virtual bool run(OperationContext* opCtx, - std::string const& db, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result); + virtual bool errmsgRun(OperationContext* opCtx, + std::string const& db, + const BSONObj& cmdObj, + std::string& errmsg, + BSONObjBuilder& result); static char const* const commandName; } cpuProfilerStartCommandInstance; @@ -119,11 +119,11 @@ class CpuProfilerStopCommand : public CpuProfilerCommand { public: CpuProfilerStopCommand() : CpuProfilerCommand(commandName) {} - virtual bool run(OperationContext* opCtx, - std::string const& db, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result); + virtual bool errmsgRun(OperationContext* opCtx, + std::string const& db, + const BSONObj& cmdObj, + std::string& errmsg, + BSONObjBuilder& result); static char const* const commandName; } cpuProfilerStopCommandInstance; @@ -131,11 +131,11 @@ public: char const* const CpuProfilerStartCommand::commandName = "_cpuProfilerStart"; char const* const CpuProfilerStopCommand::commandName = "_cpuProfilerStop"; -bool CpuProfilerStartCommand::run(OperationContext* opCtx, - std::string const& db, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result) { +bool CpuProfilerStartCommand::errmsgRun(OperationContext* opCtx, + std::string const& db, + 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 Lock::DBLock dbXLock(opCtx, db, MODE_X); OldClientContext ctx(opCtx, db, false /* no shard version checking */); @@ -148,11 +148,11 @@ bool CpuProfilerStartCommand::run(OperationContext* opCtx, return true; } -bool CpuProfilerStopCommand::run(OperationContext* opCtx, - std::string const& db, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result) { +bool CpuProfilerStopCommand::errmsgRun(OperationContext* opCtx, + std::string const& db, + 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 Lock::DBLock dbXLock(opCtx, db, MODE_X); OldClientContext ctx(opCtx, db, false /* no shard version checking */); diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 563a173d7b9..230ca733659 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -208,9 +208,9 @@ StatusWith<std::vector<BSONObj>> resolveCollectionDefaultProperties( /** * { createIndexes : "bar", indexes : [ { ns : "test.bar", key : { x : 1 }, name: "x_1" } ] } */ -class CmdCreateIndex : public BasicCommand { +class CmdCreateIndex : public ErrmsgCommandDeprecated { public: - CmdCreateIndex() : BasicCommand(kCommandName) {} + CmdCreateIndex() : ErrmsgCommandDeprecated(kCommandName) {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return true; @@ -230,11 +230,11 @@ public: return Status(ErrorCodes::Unauthorized, "Unauthorized"); } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString ns(parseNsCollectionRequired(dbname, cmdObj)); Status status = userAllowedWriteNS(ns); diff --git a/src/mongo/db/commands/current_op_common.cpp b/src/mongo/db/commands/current_op_common.cpp index b3b8ec18061..2e2a1ec799d 100644 --- a/src/mongo/db/commands/current_op_common.cpp +++ b/src/mongo/db/commands/current_op_common.cpp @@ -39,7 +39,6 @@ namespace mongo { bool CurrentOpCommandBase::run(OperationContext* opCtx, const std::string& dbName, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { // Convert the currentOp command spec into an equivalent aggregation command. This will be // of the form {aggregate:1, pipeline: [{$currentOp: {idleConnections: $all, allUsers: diff --git a/src/mongo/db/commands/current_op_common.h b/src/mongo/db/commands/current_op_common.h index 9fb143bd271..1a3ae46a1ec 100644 --- a/src/mongo/db/commands/current_op_common.h +++ b/src/mongo/db/commands/current_op_common.h @@ -58,7 +58,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) final; private: diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index ac68b36e727..ee67ed17ccb 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -124,7 +124,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { bool force = cmdObj.hasField("force") && cmdObj["force"].trueValue(); @@ -173,7 +172,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { // disallow dropping the config database if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer && @@ -211,7 +209,7 @@ public: } cmdDropDatabase; -class CmdRepairDatabase : public BasicCommand { +class CmdRepairDatabase : public ErrmsgCommandDeprecated { public: virtual bool slaveOk() const { return true; @@ -236,13 +234,13 @@ public: out->push_back(Privilege(ResourcePattern::forDatabaseName(dbname), actions)); } - CmdRepairDatabase() : BasicCommand("repairDatabase") {} + CmdRepairDatabase() : ErrmsgCommandDeprecated("repairDatabase") {} - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { BSONElement e = cmdObj.firstElement(); if (e.numberInt() != 1) { errmsg = "bad option"; @@ -296,7 +294,7 @@ public: todo: how do we handle profiling information put in the db with replication? sensibly or not? */ -class CmdProfile : public BasicCommand { +class CmdProfile : public ErrmsgCommandDeprecated { public: virtual bool slaveOk() const { return true; @@ -339,13 +337,13 @@ public: return Status(ErrorCodes::Unauthorized, "unauthorized"); } - CmdProfile() : BasicCommand("profile") {} + CmdProfile() : ErrmsgCommandDeprecated("profile") {} - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { BSONElement firstElement = cmdObj.firstElement(); int profilingLevel = firstElement.numberInt(); @@ -426,7 +424,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const char* deprecationWarning = "CMD diagLogging is deprecated and will be removed in a future release"; @@ -455,9 +452,9 @@ public: } cmddiaglogging; /* drop collection */ -class CmdDrop : public BasicCommand { +class CmdDrop : public ErrmsgCommandDeprecated { public: - CmdDrop() : BasicCommand("drop") {} + CmdDrop() : ErrmsgCommandDeprecated("drop") {} virtual bool slaveOk() const { return false; } @@ -480,11 +477,11 @@ public: return true; } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString nsToDrop = parseNsCollectionRequired(dbname, cmdObj); if (NamespaceString::virtualized(nsToDrop.ns())) { @@ -540,7 +537,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString ns(parseNsCollectionRequired(dbname, cmdObj)); @@ -668,7 +664,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& jsobj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString nss(parseNs(dbname, jsobj)); @@ -803,13 +798,13 @@ public: } cmdFileMD5; -class CmdDatasize : public BasicCommand { +class CmdDatasize : public ErrmsgCommandDeprecated { virtual string parseNs(const string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } public: - CmdDatasize() : BasicCommand("dataSize", "datasize") {} + CmdDatasize() : ErrmsgCommandDeprecated("dataSize", "datasize") {} virtual bool slaveOk() const { return true; @@ -838,11 +833,11 @@ public: out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& jsobj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& jsobj, + string& errmsg, + BSONObjBuilder& result) { Timer timer; string ns = jsobj.firstElement().String(); @@ -957,9 +952,9 @@ public: } cmdDatasize; -class CollectionStats : public BasicCommand { +class CollectionStats : public ErrmsgCommandDeprecated { public: - CollectionStats() : BasicCommand("collStats", "collstats") {} + CollectionStats() : ErrmsgCommandDeprecated("collStats", "collstats") {} virtual bool slaveOk() const { return true; @@ -981,11 +976,11 @@ public: out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& jsobj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& jsobj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, jsobj)); if (nss.coll().empty()) { @@ -1032,7 +1027,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& jsobj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, jsobj)); return appendCommandStatus(result, collMod(opCtx, nss, jsobj, &result)); @@ -1040,9 +1034,9 @@ public: } collectionModCommand; -class DBStats : public BasicCommand { +class DBStats : public ErrmsgCommandDeprecated { public: - DBStats() : BasicCommand("dbStats", "dbstats") {} + DBStats() : ErrmsgCommandDeprecated("dbStats", "dbstats") {} virtual bool slaveOk() const { return true; @@ -1064,11 +1058,11 @@ public: out->push_back(Privilege(ResourcePattern::forDatabaseName(dbname), actions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& jsobj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& jsobj, + string& errmsg, + BSONObjBuilder& result) { int scale = 1; if (jsobj["scale"].isNumber()) { scale = jsobj["scale"].numberInt(); @@ -1151,7 +1145,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { result << "you" << opCtx->getClient()->clientAddress(true /*includePort*/); return true; @@ -1177,7 +1170,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { result << "options" << QueryOption_AllSupported; return true; diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index b288be37c4d..78d4839e45c 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -52,9 +52,9 @@ namespace mongo { namespace { -class DBHashCmd : public BasicCommand { +class DBHashCmd : public ErrmsgCommandDeprecated { public: - DBHashCmd() : BasicCommand("dbHash", "dbhash") {} + DBHashCmd() : ErrmsgCommandDeprecated("dbHash", "dbhash") {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; @@ -72,11 +72,11 @@ public: out->push_back(Privilege(ResourcePattern::forDatabaseName(dbname), actions)); } - virtual bool run(OperationContext* opCtx, - const std::string& dbname, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const std::string& dbname, + const BSONObj& cmdObj, + std::string& errmsg, + BSONObjBuilder& result) { Timer timer; std::set<std::string> desiredCollections; diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index 62d21c239e9..a0eceaaa7d5 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -158,7 +158,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, 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 589c2303bdb..2f1e688aa15 100644 --- a/src/mongo/db/commands/driverHelpers.cpp +++ b/src/mongo/db/commands/driverHelpers.cpp @@ -52,9 +52,9 @@ namespace mongo { using std::string; -class BasicDriverHelper : public BasicCommand { +class BasicDriverHelper : public ErrmsgCommandDeprecated { public: - BasicDriverHelper(const char* name) : BasicCommand(name) {} + BasicDriverHelper(const char* name) : ErrmsgCommandDeprecated(name) {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; @@ -73,11 +73,11 @@ public: virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(OperationContext* opCtx, - const string&, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string&, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { if (cmdObj.firstElement().type() != jstOID) { errmsg = "not oid"; return false; diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp index 42a16dad2ab..1faedbb761c 100644 --- a/src/mongo/db/commands/drop_indexes.cpp +++ b/src/mongo/db/commands/drop_indexes.cpp @@ -87,7 +87,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& jsobj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString nss = parseNsCollectionRequired(dbname, jsobj); return appendCommandStatus(result, dropIndexes(opCtx, nss, jsobj, &result)); @@ -95,7 +94,7 @@ public: } cmdDropIndexes; -class CmdReIndex : public BasicCommand { +class CmdReIndex : public ErrmsgCommandDeprecated { public: virtual bool slaveOk() const { return true; @@ -113,13 +112,13 @@ public: actions.addAction(ActionType::reIndex); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - CmdReIndex() : BasicCommand("reIndex") {} + CmdReIndex() : ErrmsgCommandDeprecated("reIndex") {} - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& jsobj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& jsobj, + string& errmsg, + BSONObjBuilder& result) { DBDirectClient db(opCtx); const NamespaceString toReIndexNs = parseNsCollectionRequired(dbname, jsobj); diff --git a/src/mongo/db/commands/eval.cpp b/src/mongo/db/commands/eval.cpp index bb7e13f1cfb..28a73562df7 100644 --- a/src/mongo/db/commands/eval.cpp +++ b/src/mongo/db/commands/eval.cpp @@ -152,7 +152,7 @@ bool dbEval(OperationContext* opCtx, } -class CmdEval : public BasicCommand { +class CmdEval : public ErrmsgCommandDeprecated { public: virtual bool slaveOk() const { return false; @@ -172,13 +172,13 @@ public: RoleGraph::generateUniversalPrivileges(out); } - CmdEval() : BasicCommand("eval", "$eval") {} + CmdEval() : ErrmsgCommandDeprecated("eval", "$eval") {} - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { // Note: 'eval' is not allowed to touch sharded namespaces, but we can't check the // shardVersions of the namespaces accessed in the script until the script is evaluated. // Instead, we enforce that the script does not access sharded namespaces by ensuring the diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp index ec07e0f5106..c2b3893c15e 100644 --- a/src/mongo/db/commands/explain_cmd.cpp +++ b/src/mongo/db/commands/explain_cmd.cpp @@ -123,7 +123,6 @@ public: virtual bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { auto verbosity = ExplainOptions::parseCmdBSON(cmdObj); if (!verbosity.isOK()) { diff --git a/src/mongo/db/commands/fail_point_cmd.cpp b/src/mongo/db/commands/fail_point_cmd.cpp index 74da22e059c..c5fcda4b995 100644 --- a/src/mongo/db/commands/fail_point_cmd.cpp +++ b/src/mongo/db/commands/fail_point_cmd.cpp @@ -64,9 +64,9 @@ using std::stringstream; * data: <Object> // optional arbitrary object to store. * } */ -class FaultInjectCmd : public BasicCommand { +class FaultInjectCmd : public ErrmsgCommandDeprecated { public: - FaultInjectCmd() : BasicCommand("configureFailPoint") {} + FaultInjectCmd() : ErrmsgCommandDeprecated("configureFailPoint") {} virtual bool slaveOk() const { return true; @@ -90,11 +90,11 @@ public: h << "modifies the settings of a fail point"; } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const string failPointName(cmdObj.firstElement().str()); FailPointRegistry* registry = getGlobalFailPointRegistry(); FailPoint* failPoint = registry->getFailPoint(failPointName); diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index d83a44beec4..8014c67ecd0 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -338,7 +338,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbName, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) override { // findAndModify command is not replicated directly. invariant(opCtx->writesAreReplicated()); diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 392ccfcb066..8d89469a27f 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -221,7 +221,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, 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 b266281f19b..e4c3aca53bd 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -78,13 +78,13 @@ public: virtual void run(); }; -class FSyncCommand : public BasicCommand { +class FSyncCommand : public ErrmsgCommandDeprecated { public: static const char* url() { return "http://dochub.mongodb.org/core/fsynccommand"; } - FSyncCommand() : BasicCommand("fsync") {} + FSyncCommand() : ErrmsgCommandDeprecated("fsync") {} virtual ~FSyncCommand() { // The FSyncLockThread is owned by the FSyncCommand and accesses FsyncCommand state. It must @@ -117,11 +117,11 @@ public: actions.addAction(ActionType::fsync); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { if (opCtx->lockState()->isLocked()) { errmsg = "fsync: Cannot execute fsync command from contexts that hold a data lock"; return false; @@ -264,9 +264,9 @@ private: bool _fsyncLocked = false; } fsyncCmd; -class FSyncUnlockCommand : public BasicCommand { +class FSyncUnlockCommand : public ErrmsgCommandDeprecated { public: - FSyncUnlockCommand() : BasicCommand("fsyncUnlock") {} + FSyncUnlockCommand() : ErrmsgCommandDeprecated("fsyncUnlock") {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { @@ -290,11 +290,11 @@ public: return isAuthorized ? Status::OK() : Status(ErrorCodes::Unauthorized, "Unauthorized"); } - bool run(OperationContext* opCtx, - const std::string& db, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result) override { + bool errmsgRun(OperationContext* opCtx, + const std::string& db, + const BSONObj& cmdObj, + std::string& errmsg, + BSONObjBuilder& result) override { log() << "command: unlock requested"; Lock::ExclusiveLock lk(opCtx->lockState(), commandMutex); diff --git a/src/mongo/db/commands/generic.cpp b/src/mongo/db/commands/generic.cpp index a9b3e982c23..35998427356 100644 --- a/src/mongo/db/commands/generic.cpp +++ b/src/mongo/db/commands/generic.cpp @@ -92,7 +92,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& jsobj, - std::string& errmsg, BSONObjBuilder& result) { VersionInfoInterface::instance().appendBuildInfo(&result); appendStorageEngineList(&result); @@ -121,7 +120,6 @@ public: virtual bool run(OperationContext* opCtx, const string& badns, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { // IMPORTANT: Don't put anything in here that might lock db - including authentication return true; @@ -146,7 +144,6 @@ public: virtual bool run(OperationContext* opCtx, const string& ns, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { if (getGlobalScriptEngine()) { BSONObjBuilder bb(result.subobjStart("js")); @@ -188,7 +185,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { ProcessInfo p; BSONObjBuilder bSys, bOs; @@ -235,7 +231,6 @@ public: virtual bool run(OperationContext* opCtx, const string& ns, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { bool didRotate = rotateLogs(serverGlobalParams.logRenameOnRotate); if (didRotate) @@ -266,7 +261,6 @@ public: virtual bool run(OperationContext* opCtx, const string& ns, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { // sort the commands before building the result BSON std::vector<Command*> commands; @@ -364,16 +358,15 @@ public: bool run(OperationContext* opCtx, const string& dbnamne, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { LastError::get(cc()).setLastError(10038, "forced error"); return false; } } cmdForceError; -class GetLogCmd : public BasicCommand { +class GetLogCmd : public ErrmsgCommandDeprecated { public: - GetLogCmd() : BasicCommand("getLog") {} + GetLogCmd() : ErrmsgCommandDeprecated("getLog") {} virtual bool slaveOk() const { return true; @@ -395,11 +388,11 @@ public: help << "{ getLog : '*' } OR { getLog : 'global' }"; } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { BSONElement val = cmdObj.firstElement(); if (val.type() != String) { return appendCommandStatus( @@ -469,7 +462,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { std::string logName; Status status = bsonExtractStringField(cmdObj, "clearLog", &logName); @@ -521,7 +513,6 @@ public: virtual bool run(OperationContext* opCtx, const string&, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { result.append("argv", serverGlobalParams.argvArray); result.append("parsed", serverGlobalParams.parsedOpts); diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp index c40625ed1c7..238f97eaa80 100644 --- a/src/mongo/db/commands/geo_near_cmd.cpp +++ b/src/mongo/db/commands/geo_near_cmd.cpp @@ -60,9 +60,9 @@ namespace mongo { using std::unique_ptr; using std::stringstream; -class Geo2dFindNearCmd : public BasicCommand { +class Geo2dFindNearCmd : public ErrmsgCommandDeprecated { public: - Geo2dFindNearCmd() : BasicCommand("geoNear") {} + Geo2dFindNearCmd() : ErrmsgCommandDeprecated("geoNear") {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; @@ -97,11 +97,11 @@ public: out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { if (!cmdObj["start"].eoo()) { errmsg = "using deprecated 'start' argument to geoNear"; return false; diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp index 80ebfb78e8e..536e1d18814 100644 --- a/src/mongo/db/commands/get_last_error.cpp +++ b/src/mongo/db/commands/get_last_error.cpp @@ -73,16 +73,15 @@ public: bool run(OperationContext* opCtx, const string& db, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { LastError::get(opCtx->getClient()).reset(); return true; } } cmdResetError; -class CmdGetLastError : public BasicCommand { +class CmdGetLastError : public ErrmsgCommandDeprecated { public: - CmdGetLastError() : BasicCommand("getLastError", "getlasterror") {} + CmdGetLastError() : ErrmsgCommandDeprecated("getLastError", "getlasterror") {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -103,11 +102,11 @@ public: << " { wtimeout:m} - timeout for w in m milliseconds"; } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { // // Correct behavior here is very finicky. // @@ -314,7 +313,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { LastError* le = &LastError::get(opCtx->getClient()); le->disable(); diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 456799b070f..48b77395635 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -150,7 +150,6 @@ public: const NamespaceString& origNss, const GetMoreRequest& request, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { auto curOp = CurOp::get(opCtx); @@ -399,7 +398,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) override { // Counted as a getMore, not as a command. globalOpCounters.gotGetMore(); @@ -415,7 +413,7 @@ public: return appendCommandStatus(result, parsedRequest.getStatus()); } auto request = parsedRequest.getValue(); - return runParsed(opCtx, request.nss, request, cmdObj, errmsg, result); + return runParsed(opCtx, request.nss, request, cmdObj, result); } /** diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp index 5aab82e6fd3..880030387c5 100644 --- a/src/mongo/db/commands/group_cmd.cpp +++ b/src/mongo/db/commands/group_cmd.cpp @@ -150,7 +150,6 @@ private: virtual bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { RARELY { warning() << "The group command is deprecated. See " diff --git a/src/mongo/db/commands/hashcmd.cpp b/src/mongo/db/commands/hashcmd.cpp index 78f76370b15..0b4ebdba718 100644 --- a/src/mongo/db/commands/hashcmd.cpp +++ b/src/mongo/db/commands/hashcmd.cpp @@ -50,9 +50,9 @@ using std::string; using std::stringstream; // Testing only, enabled via command-line. -class CmdHashElt : public BasicCommand { +class CmdHashElt : public ErrmsgCommandDeprecated { public: - CmdHashElt() : BasicCommand("_hashBSONElement"){}; + CmdHashElt() : ErrmsgCommandDeprecated("_hashBSONElement"){}; virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -79,11 +79,11 @@ public: *> "out" : NumberLong(6271151123721111923), *> "ok" : 1 } **/ - bool run(OperationContext* opCtx, - const string& db, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& db, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { result.appendAs(cmdObj.firstElement(), "key"); int seed = 0; diff --git a/src/mongo/db/commands/haystack.cpp b/src/mongo/db/commands/haystack.cpp index d8f418b4ccb..be169c7ded3 100644 --- a/src/mongo/db/commands/haystack.cpp +++ b/src/mongo/db/commands/haystack.cpp @@ -59,9 +59,9 @@ namespace mongo { using std::string; using std::vector; -class GeoHaystackSearchCommand : public BasicCommand { +class GeoHaystackSearchCommand : public ErrmsgCommandDeprecated { public: - GeoHaystackSearchCommand() : BasicCommand("geoSearch") {} + GeoHaystackSearchCommand() : ErrmsgCommandDeprecated("geoSearch") {} virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; @@ -95,11 +95,11 @@ public: out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString nss = parseNsCollectionRequired(dbname, cmdObj); AutoGetCollectionForReadCommand ctx(opCtx, nss); diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp index e1fdc732d2e..c7e3b2043bc 100644 --- a/src/mongo/db/commands/index_filter_commands.cpp +++ b/src/mongo/db/commands/index_filter_commands.cpp @@ -118,7 +118,6 @@ IndexFilterCommand::IndexFilterCommand(const string& name, const string& helpTex bool IndexFilterCommand::run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); Status status = runIndexFilterCommand(opCtx, nss.ns(), cmdObj, &result); diff --git a/src/mongo/db/commands/index_filter_commands.h b/src/mongo/db/commands/index_filter_commands.h index 7cdf97c8205..6a313e1f93c 100644 --- a/src/mongo/db/commands/index_filter_commands.h +++ b/src/mongo/db/commands/index_filter_commands.h @@ -66,7 +66,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result); virtual bool supportsWriteConcern(const BSONObj& cmd) const override; diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp index 6186dab0d8b..ed7605f14b7 100644 --- a/src/mongo/db/commands/isself.cpp +++ b/src/mongo/db/commands/isself.cpp @@ -57,7 +57,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { result.append("id", repl::instanceId); return true; diff --git a/src/mongo/db/commands/kill_op.cpp b/src/mongo/db/commands/kill_op.cpp index 5cd6b40d4ac..7b07c87f7ba 100644 --- a/src/mongo/db/commands/kill_op.cpp +++ b/src/mongo/db/commands/kill_op.cpp @@ -131,7 +131,6 @@ public: bool run(OperationContext* opCtx, const std::string& db, 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 eaa9ec51baf..0dcc262f56f 100644 --- a/src/mongo/db/commands/killcursors_common.cpp +++ b/src/mongo/db/commands/killcursors_common.cpp @@ -66,7 +66,6 @@ Status KillCursorsCmdBase::checkAuthForCommand(Client* client, bool KillCursorsCmdBase::run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { auto statusWithRequest = KillCursorsRequest::parseFromBSON(dbname, cmdObj); if (!statusWithRequest.isOK()) { diff --git a/src/mongo/db/commands/killcursors_common.h b/src/mongo/db/commands/killcursors_common.h index 281a5be828e..43a0443ff80 100644 --- a/src/mongo/db/commands/killcursors_common.h +++ b/src/mongo/db/commands/killcursors_common.h @@ -74,7 +74,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) final; private: diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index ee972bc64e8..ca13ebffab2 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -232,7 +232,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, 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 fe24e9b8967..b25a13b887b 100644 --- a/src/mongo/db/commands/list_databases.cpp +++ b/src/mongo/db/commands/list_databases.cpp @@ -86,7 +86,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& jsobj, - string& errmsg, BSONObjBuilder& result) { // Parse the filter. std::unique_ptr<MatchExpression> filter; diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp index 5502b9add2f..a050e9adfff 100644 --- a/src/mongo/db/commands/list_indexes.cpp +++ b/src/mongo/db/commands/list_indexes.cpp @@ -119,7 +119,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString ns(parseNsOrUUID(opCtx, dbname, cmdObj)); const long long defaultBatchSize = std::numeric_limits<long long>::max(); diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp index 4becb45fcc0..7273a5ff238 100644 --- a/src/mongo/db/commands/lock_info.cpp +++ b/src/mongo/db/commands/lock_info.cpp @@ -82,7 +82,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, 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 dcb694116a1..cdb8a757068 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1325,9 +1325,9 @@ BSONObj _bailFromJS(const BSONObj& args, void* data) { /** * This class represents a map/reduce command executed on a single server */ -class MapReduceCommand : public BasicCommand { +class MapReduceCommand : public ErrmsgCommandDeprecated { public: - MapReduceCommand() : BasicCommand("mapReduce", "mapreduce") {} + MapReduceCommand() : ErrmsgCommandDeprecated("mapReduce", "mapreduce") {} virtual bool slaveOk() const { return repl::getGlobalReplicationCoordinator()->getReplicationMode() != @@ -1359,11 +1359,11 @@ public: addPrivilegesRequiredForMapReduce(this, dbname, cmdObj, out); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmd, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmd, + string& errmsg, + BSONObjBuilder& result) { Timer t; boost::optional<DisableDocumentValidation> maybeDisableValidation; @@ -1680,7 +1680,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { return appendCommandStatus( diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index d95301fb484..6802f4843c1 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -115,7 +115,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auto replCoord = repl::ReplicationCoordinator::get(opCtx); if (!replCoord->isReplEnabled()) { diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index debd6973295..cfee00e4888 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -88,7 +88,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString ns(parseNsOrUUID(opCtx, dbname, cmdObj)); diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp index 79d2421553e..2c0164fdae9 100644 --- a/src/mongo/db/commands/parameters.cpp +++ b/src/mongo/db/commands/parameters.cpp @@ -63,9 +63,9 @@ void appendParameterNames(stringstream& help) { } } -class CmdGet : public BasicCommand { +class CmdGet : public ErrmsgCommandDeprecated { public: - CmdGet() : BasicCommand("getParameter") {} + CmdGet() : ErrmsgCommandDeprecated("getParameter") {} virtual bool slaveOk() const { return true; } @@ -88,11 +88,11 @@ public: appendParameterNames(help); help << "{ getParameter:'*' } to get everything\n"; } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { bool all = *cmdObj.firstElement().valuestrsafe() == '*'; int before = result.len(); @@ -112,9 +112,9 @@ public: } } cmdGet; -class CmdSet : public BasicCommand { +class CmdSet : public ErrmsgCommandDeprecated { public: - CmdSet() : BasicCommand("setParameter") {} + CmdSet() : ErrmsgCommandDeprecated("setParameter") {} virtual bool slaveOk() const { return true; } @@ -136,11 +136,11 @@ public: help << "{ setParameter:1, <param>:<value> }\n"; appendParameterNames(help); } - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { int numSet = 0; bool found = false; diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 651cb2c9c9d..9d0c83e7af9 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -83,7 +83,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) override { const auto aggregationRequest = uassertStatusOK(AggregationRequest::parseFromBSON(dbname, cmdObj, boost::none)); diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index 7f5e0209695..f66bc7392b2 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -113,7 +113,6 @@ PlanCacheCommand::PlanCacheCommand(const string& name, bool PlanCacheCommand::run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); Status status = runPlanCacheCommand(opCtx, nss.ns(), cmdObj, &result); diff --git a/src/mongo/db/commands/plan_cache_commands.h b/src/mongo/db/commands/plan_cache_commands.h index 8312e12aa8c..da3400ca863 100644 --- a/src/mongo/db/commands/plan_cache_commands.h +++ b/src/mongo/db/commands/plan_cache_commands.h @@ -60,7 +60,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result); virtual bool supportsWriteConcern(const BSONObj& cmd) const override; diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp index a5a54249d5a..0afd8e7dce6 100644 --- a/src/mongo/db/commands/rename_collection_cmd.cpp +++ b/src/mongo/db/commands/rename_collection_cmd.cpp @@ -56,9 +56,9 @@ using std::stringstream; namespace { -class CmdRenameCollection : public BasicCommand { +class CmdRenameCollection : public ErrmsgCommandDeprecated { public: - CmdRenameCollection() : BasicCommand("renameCollection") {} + CmdRenameCollection() : ErrmsgCommandDeprecated("renameCollection") {} virtual bool adminOnly() const { return true; } @@ -85,11 +85,11 @@ public: } } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const auto sourceNsElt = cmdObj[getName()]; const auto targetNsElt = cmdObj["to"]; diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp index b1b2b7bd963..5154731e423 100644 --- a/src/mongo/db/commands/repair_cursor.cpp +++ b/src/mongo/db/commands/repair_cursor.cpp @@ -70,7 +70,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { NamespaceString ns(parseNs(dbname, cmdObj)); diff --git a/src/mongo/db/commands/resize_oplog.cpp b/src/mongo/db/commands/resize_oplog.cpp index 7166d76c96f..3323cfc996c 100644 --- a/src/mongo/db/commands/resize_oplog.cpp +++ b/src/mongo/db/commands/resize_oplog.cpp @@ -84,7 +84,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& jsobj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString nss("local", "oplog.rs"); Lock::GlobalWrite global(opCtx); diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp index 8475560432c..1d559708d73 100644 --- a/src/mongo/db/commands/server_status.cpp +++ b/src/mongo/db/commands/server_status.cpp @@ -88,7 +88,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, 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 b8b4cca670e..002cf2d1bce 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -85,7 +85,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { const auto version = uassertStatusOK( FeatureCompatibilityVersionCommandParser::extractVersionFromCommand(getName(), cmdObj)); diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp index e9004704842..8fd1742a792 100644 --- a/src/mongo/db/commands/snapshot_management.cpp +++ b/src/mongo/db/commands/snapshot_management.cpp @@ -67,7 +67,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { auto snapshotManager = getGlobalServiceContext()->getGlobalStorageEngine()->getSnapshotManager(); @@ -116,7 +115,6 @@ public: bool run(OperationContext* opCtx, const std::string& dbname, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { auto snapshotManager = getGlobalServiceContext()->getGlobalStorageEngine()->getSnapshotManager(); diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index ffc7bf48466..0b3d1e2091d 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -56,9 +56,9 @@ using std::string; using std::stringstream; /* For testing only, not for general use. Enabled via command-line */ -class GodInsert : public BasicCommand { +class GodInsert : public ErrmsgCommandDeprecated { public: - GodInsert() : BasicCommand("godinsert") {} + GodInsert() : ErrmsgCommandDeprecated("godinsert") {} virtual bool adminOnly() const { return false; } @@ -75,11 +75,11 @@ public: virtual void help(stringstream& help) const { help << "internal. for testing only."; } - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); log() << "test only command godinsert invoked coll:" << nss.coll(); BSONObj obj = cmdObj["obj"].embeddedObjectUserCheck(); @@ -152,7 +152,6 @@ public: bool run(OperationContext* opCtx, const string& ns, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { log() << "test only command sleep invoked"; long long millis = 0; @@ -215,7 +214,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { const NamespaceString fullNs = parseNsCollectionRequired(dbname, cmdObj); if (!fullNs.isValid()) { @@ -292,7 +290,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, 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 afb1d3401f3..678bb86b320 100644 --- a/src/mongo/db/commands/top_command.cpp +++ b/src/mongo/db/commands/top_command.cpp @@ -68,7 +68,6 @@ public: virtual bool run(OperationContext* opCtx, const std::string& db, const BSONObj& cmdObj, - std::string& errmsg, BSONObjBuilder& result) { { BSONObjBuilder b(result.subobjStart("totals")); diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp index 00bd08dbe50..fe7dd6b0cf5 100644 --- a/src/mongo/db/commands/touch.cpp +++ b/src/mongo/db/commands/touch.cpp @@ -53,7 +53,7 @@ namespace mongo { using std::string; using std::stringstream; -class TouchCmd : public BasicCommand { +class TouchCmd : public ErrmsgCommandDeprecated { public: virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return false; @@ -80,13 +80,13 @@ public: actions.addAction(ActionType::touch); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - TouchCmd() : BasicCommand("touch") {} + TouchCmd() : ErrmsgCommandDeprecated("touch") {} - virtual bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + virtual bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { const NamespaceString nss = parseNsCollectionRequired(dbname, cmdObj); if (!nss.isNormal()) { errmsg = "bad namespace name"; diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index ecb54541df1..49926a76e53 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -619,7 +619,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::CreateOrUpdateUserArgs args; Status status = auth::parseCreateOrUpdateUserCommands(cmdObj, "createUser", dbname, &args); @@ -765,7 +764,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::CreateOrUpdateUserArgs args; Status status = auth::parseCreateOrUpdateUserCommands(cmdObj, "updateUser", dbname, &args); @@ -882,7 +880,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { UserName userName; Status status = auth::parseAndValidateDropUserCommand(cmdObj, dbname, &userName); @@ -950,7 +947,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { Status status = auth::parseAndValidateDropAllUsersFromDatabaseCommand(cmdObj, dbname); if (!status.isOK()) { @@ -1007,7 +1003,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { std::string userNameString; std::vector<RoleName> roles; @@ -1081,7 +1076,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { std::string userNameString; std::vector<RoleName> roles; @@ -1159,7 +1153,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::UsersInfoArgs args; Status status = auth::parseUsersInfoCommand(cmdObj, dbname, &args); @@ -1272,7 +1265,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::CreateOrUpdateRoleArgs args; Status status = auth::parseCreateOrUpdateRoleCommands(cmdObj, "createRole", dbname, &args); @@ -1385,7 +1377,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::CreateOrUpdateRoleArgs args; Status status = auth::parseCreateOrUpdateRoleCommands(cmdObj, "updateRole", dbname, &args); @@ -1483,7 +1474,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { RoleName roleName; @@ -1591,7 +1581,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { RoleName roleName; PrivilegeVector privilegesToRemove; @@ -1701,7 +1690,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { std::string roleNameString; std::vector<RoleName> rolesToAdd; @@ -1792,7 +1780,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { std::string roleNameString; std::vector<RoleName> rolesToRemove; @@ -1882,7 +1869,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { RoleName roleName; Status status = auth::parseDropRoleCommand(cmdObj, dbname, &roleName); @@ -2036,7 +2022,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { Status status = auth::parseDropAllRolesFromDatabaseCommand(cmdObj, dbname); if (!status.isOK()) { @@ -2179,7 +2164,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::RolesInfoArgs args; Status status = auth::parseRolesInfoCommand(cmdObj, dbname, &args); @@ -2260,7 +2244,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { AuthorizationManager* authzManager = getGlobalAuthorizationManager(); authzManager->invalidateUserCache(); @@ -2298,7 +2281,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { AuthorizationManager* authzManager = getGlobalAuthorizationManager(); result.append("cacheGeneration", authzManager->getCacheGeneration()); @@ -2675,7 +2657,6 @@ public: bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::MergeAuthzCollectionsArgs args; Status status = auth::parseMergeAuthzCollectionsCommand(cmdObj, &args); @@ -2916,7 +2897,6 @@ public: virtual bool run(OperationContext* opCtx, const string& dbname, const BSONObj& cmdObj, - string& errmsg, BSONObjBuilder& result) { auth::AuthSchemaUpgradeArgs parsedArgs; Status status = auth::parseAuthSchemaUpgradeCommand(cmdObj, dbname, &parsedArgs); diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index a4a5e98b888..b506104cb73 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -49,9 +49,9 @@ using std::stringstream; MONGO_FP_DECLARE(validateCmdCollectionNotValid); -class ValidateCmd : public BasicCommand { +class ValidateCmd : public ErrmsgCommandDeprecated { public: - ValidateCmd() : BasicCommand("validate") {} + ValidateCmd() : ErrmsgCommandDeprecated("validate") {} virtual bool slaveOk() const { return true; @@ -75,11 +75,11 @@ public: } //{ validate: "collectionnamewithoutthedbpart" [, scandata: <bool>] [, full: <bool> } */ - bool run(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const string& dbname, + const BSONObj& cmdObj, + string& errmsg, + BSONObjBuilder& result) { if (MONGO_FAIL_POINT(validateCmdCollectionNotValid)) { errmsg = "validateCmdCollectionNotValid fail point was triggered"; result.appendBool("valid", false); |