summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/explain_cmd.cpp
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2018-04-20 15:58:46 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2018-05-01 10:31:16 -0400
commit2ed975c6d96dfe0b61bea703ea4f9086b1cee24e (patch)
tree7992d2faf077b4ba15251d41cc5733f451562f47 /src/mongo/db/commands/explain_cmd.cpp
parentbf76453a0dcb0e4309f5b249cfe30cffe101b1b4 (diff)
downloadmongo-2ed975c6d96dfe0b61bea703ea4f9086b1cee24e.tar.gz
SERVER-34596 remove Command::parseNs
Diffstat (limited to 'src/mongo/db/commands/explain_cmd.cpp')
-rw-r--r--src/mongo/db/commands/explain_cmd.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp
index 652d1a8f2ac..71dfc51d19d 100644
--- a/src/mongo/db/commands/explain_cmd.cpp
+++ b/src/mongo/db/commands/explain_cmd.cpp
@@ -74,19 +74,6 @@ public:
return "explain database reads and writes";
}
- std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const override {
- uassert(ErrorCodes::BadValue,
- "explain command requires a nested object",
- Object == cmdObj.firstElement().type());
- auto explainedObj = cmdObj.firstElement().Obj();
- auto explainedCommand = CommandHelpers::findCommand(explainedObj.firstElementFieldName());
- uassert(ErrorCodes::CommandNotFound,
- str::stream() << "explain failed due to unknown command: "
- << explainedObj.firstElementFieldName(),
- explainedCommand);
- return explainedCommand->parseNs(dbname, explainedObj);
- }
-
private:
class Invocation;
};
@@ -101,7 +88,6 @@ public:
: CommandInvocation(explainCommand),
_outerRequest{&request},
_dbName{_outerRequest->getDatabase().toString()},
- _ns{explainCommand->parseNs(_dbName, _outerRequest->body)},
_verbosity{std::move(verbosity)},
_innerRequest{std::move(innerRequest)},
_innerInvocation{std::move(innerInvocation)} {}
@@ -115,8 +101,7 @@ public:
BSONObjBuilder bob = result->getBodyBuilder();
_innerInvocation->explain(opCtx, _verbosity, &bob);
} catch (const ExceptionFor<ErrorCodes::Unauthorized>&) {
- CommandHelpers::logAuthViolation(
- opCtx, command(), *_outerRequest, ErrorCodes::Unauthorized);
+ CommandHelpers::logAuthViolation(opCtx, this, *_outerRequest, ErrorCodes::Unauthorized);
throw;
}
}
@@ -128,7 +113,7 @@ public:
}
NamespaceString ns() const override {
- return _ns;
+ return _innerInvocation->ns();
}
bool supportsWriteConcern() const override {