jesmith17 commented on code in PR #3322:
URL: https://github.com/apache/logging-log4j2/pull/3322#discussion_r1898946180


##########
log4j-mongodb/src/main/java/org/apache/logging/log4j/mongodb/MongoDbProvider.java:
##########
@@ -113,10 +136,19 @@ private MongoDbProvider(final String 
connectionStringSource, final boolean isCap
         LOGGER.debug("Creating MongoClient {}...", settings);
         this.mongoClient = MongoClients.create(settings);
         LOGGER.debug("Created MongoClient {}", mongoClient);
-        final String databaseName = this.connectionString.getDatabase();
-        LOGGER.debug("Getting MongoDatabase {}...", databaseName);
-        this.mongoDatabase = this.mongoClient.getDatabase(databaseName);
+        if (databaseName == null || databaseName.isEmpty()) {
+            this.databaseName = this.connectionString.getDatabase();
+        } else {
+            this.databaseName = databaseName;
+        }

Review Comment:
   Im on board with using the MongoNamespace check here, and actually to do the 
same with the collectionName to give it that protection. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to