summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands.cpp')
-rw-r--r--src/mongo/db/commands.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index c0ccb1336e4..3d15df11089 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -568,7 +568,7 @@ void CommandHelpers::canUseTransactions(const NamespaceString& nss,
const auto dbName = nss.dbName();
uassert(ErrorCodes::OperationNotSupportedInTransaction,
- str::stream() << "Cannot run command against the '" << dbName
+ str::stream() << "Cannot run command against the '" << dbName.toStringForErrorMsg()
<< "' database in a transaction.",
dbName.db() != DatabaseName::kLocal.db());
@@ -876,10 +876,11 @@ void CommandInvocation::checkAuthorization(OperationContext* opCtx,
namespace mmb = mutablebson;
mmb::Document cmdToLog(request.body, mmb::Document::kInPlaceDisabled);
c->snipForLogging(&cmdToLog);
- auto dbname = request.getDatabase();
+ auto dbName = DatabaseNameUtil::deserialize(request.getValidatedTenantId(),
+ request.getDatabase());
uasserted(ErrorCodes::Unauthorized,
- str::stream() << "not authorized on " << dbname << " to execute command "
- << redact(cmdToLog.getObject()));
+ str::stream() << "not authorized on " << dbName.toStringForErrorMsg()
+ << " to execute command " << redact(cmdToLog.getObject()));
}
}
} catch (const DBException& e) {