diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2018-01-10 17:09:22 -0500 |
---|---|---|
committer | Billy Donahue <billy.donahue@mongodb.com> | 2018-01-16 13:52:44 -0500 |
commit | a6e45f0e35724ae7958e31fc141c89afcefe4d33 (patch) | |
tree | 5ac0bf28fc1b977078845cbff966ff3427cfaa92 /src/mongo/db/commands/test_commands.cpp | |
parent | 1378f8ec42068913c5bdc5927bbe86d5aed08814 (diff) | |
download | mongo-a6e45f0e35724ae7958e31fc141c89afcefe4d33.tar.gz |
SERVER-32646 CommandHelpers
Diffstat (limited to 'src/mongo/db/commands/test_commands.cpp')
-rw-r--r-- | src/mongo/db/commands/test_commands.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index 0b3d1e2091d..2dd96eeee8c 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -80,7 +80,7 @@ public: const BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result) { - const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); + const NamespaceString nss(CommandHelpers::parseNsCollectionRequired(dbname, cmdObj)); log() << "test only command godinsert invoked coll:" << nss.coll(); BSONObj obj = cmdObj["obj"].embeddedObjectUserCheck(); @@ -103,7 +103,7 @@ public: if (status.isOK()) { wunit.commit(); } - return appendCommandStatus(result, status); + return CommandHelpers::appendCommandStatus(result, status); } }; @@ -215,9 +215,9 @@ public: const string& dbname, const BSONObj& cmdObj, BSONObjBuilder& result) { - const NamespaceString fullNs = parseNsCollectionRequired(dbname, cmdObj); + const NamespaceString fullNs = CommandHelpers::parseNsCollectionRequired(dbname, cmdObj); if (!fullNs.isValid()) { - return appendCommandStatus( + return CommandHelpers::appendCommandStatus( result, {ErrorCodes::InvalidNamespace, str::stream() << "collection name " << fullNs.ns() << " is not valid"}); @@ -227,23 +227,23 @@ public: bool inc = cmdObj.getBoolField("inc"); // inclusive range? if (n <= 0) { - return appendCommandStatus(result, - {ErrorCodes::BadValue, "n must be a positive integer"}); + return CommandHelpers::appendCommandStatus( + result, {ErrorCodes::BadValue, "n must be a positive integer"}); } // Lock the database in mode IX and lock the collection exclusively. AutoGetCollection autoColl(opCtx, fullNs, MODE_IX, MODE_X); Collection* collection = autoColl.getCollection(); if (!collection) { - return appendCommandStatus( + return CommandHelpers::appendCommandStatus( result, {ErrorCodes::NamespaceNotFound, str::stream() << "collection " << fullNs.ns() << " does not exist"}); } if (!collection->isCapped()) { - return appendCommandStatus(result, - {ErrorCodes::IllegalOperation, "collection must be capped"}); + return CommandHelpers::appendCommandStatus( + result, {ErrorCodes::IllegalOperation, "collection must be capped"}); } RecordId end; @@ -257,7 +257,7 @@ public: for (int i = 0; i < n + 1; ++i) { PlanExecutor::ExecState state = exec->getNext(nullptr, &end); if (PlanExecutor::ADVANCED != state) { - return appendCommandStatus( + return CommandHelpers::appendCommandStatus( result, {ErrorCodes::IllegalOperation, str::stream() << "invalid n, collection contains fewer than " << n @@ -291,9 +291,9 @@ public: const string& dbname, const BSONObj& cmdObj, BSONObjBuilder& result) { - const NamespaceString nss = parseNsCollectionRequired(dbname, cmdObj); + const NamespaceString nss = CommandHelpers::parseNsCollectionRequired(dbname, cmdObj); - return appendCommandStatus(result, emptyCapped(opCtx, nss)); + return CommandHelpers::appendCommandStatus(result, emptyCapped(opCtx, nss)); } }; |