// called into by the web server. For now we just translate the parameters // to their old style equivalents. void Command::execCommand(OperationContext* txn, Command* command, const rpc::RequestInterface& request, rpc::ReplyBuilderInterface* replyBuilder) { int queryFlags = 0; BSONObj cmdObj; std::tie(cmdObj, queryFlags) = uassertStatusOK( rpc::downconvertRequestMetadata(request.getCommandArgs(), request.getMetadata()) ); std::string db = request.getDatabase().rawData(); BSONObjBuilder result; execCommandClientBasic(txn, command, *txn->getClient(), queryFlags, request.getDatabase().rawData(), cmdObj, result); replyBuilder ->setMetadata(rpc::makeEmptyMetadata()) .setCommandReply(result.done()); }
void Command::generateErrorResponse(OperationContext* txn, rpc::ReplyBuilderInterface* replyBuilder, const DBException& exception, const rpc::RequestInterface& request, Command* command, const BSONObj& metadata) { LOG(1) << "assertion while executing command '" << request.getCommandName() << "' " << "on database '" << request.getDatabase() << "' " << "with arguments '" << command->getRedactedCopyForLogging(request.getCommandArgs()) << "' " << "and metadata '" << request.getMetadata() << "': " << exception.toString(); _generateErrorResponse(txn, replyBuilder, exception, metadata); }