summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/list_databases_common.h
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2022-10-27 04:31:16 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-27 16:59:12 +0000
commit6fc0fceb929a37f34882b52bdc59a5c3aa63716f (patch)
tree5640ae3721f195af4366a4ab8967652f26166e2b /src/mongo/db/commands/list_databases_common.h
parent734191d9d0c5225ec4ca9309068cf3c04c445c74 (diff)
downloadmongo-6fc0fceb929a37f34882b52bdc59a5c3aa63716f.tar.gz
SERVER-70053 Serialize and deserialize DatabaseName correctly in multitenancy mode
Diffstat (limited to 'src/mongo/db/commands/list_databases_common.h')
-rw-r--r--src/mongo/db/commands/list_databases_common.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/db/commands/list_databases_common.h b/src/mongo/db/commands/list_databases_common.h
index 14dc0884689..2143131f882 100644
--- a/src/mongo/db/commands/list_databases_common.h
+++ b/src/mongo/db/commands/list_databases_common.h
@@ -41,6 +41,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_engine.h"
+#include "mongo/util/database_name_util.h"
namespace mongo {
@@ -97,7 +98,8 @@ int64_t setReplyItems(OperationContext* opCtx,
continue;
}
- ReplyItemType item(dbName.db());
+ // If setTenantId is true, always return the dbName without the tenantId
+ ReplyItemType item(setTenantId ? dbName.db() : DatabaseNameUtil::serialize(dbName));
if (setTenantId) {
initializeItemWithTenantId(item, dbName);
}