MongoDB: fix for empty username/password (#7487)

This commit is contained in:
Tsuneo Yoshioka
2025-07-31 23:39:39 +09:00
committed by GitHub
parent e69283f488
commit a6298f2753

View File

@@ -215,10 +215,10 @@ class MongoDB(BaseQueryRunner):
if readPreference:
kwargs["readPreference"] = readPreference
if "username" in self.configuration:
if self.configuration.get("username"):
kwargs["username"] = self.configuration["username"]
if "password" in self.configuration:
if self.configuration.get("password"):
kwargs["password"] = self.configuration["password"]
db_connection = pymongo.MongoClient(self.configuration["connectionString"], **kwargs)