mongodbspring-dataconnection-poolingjongoconnection-pool

Connection pool in MongoDB with jongo


I would like to use connection pool for MongoDB. I have used MongoDB with Jongo and Spring MVC framework.

Here is my spring xml code for MongoDB configuration, which is working fine.

<!-- Mongo Configuration -->
<mongo:mongo id="mongo" host="${mongodb.host}" port="${mongodb.port}">
</mongo:mongo>

<mongo:db-factory id="mongoDbFactory" mongo-ref="mongo" dbname="${mongodb.database}" username="${mongodb.username}" password="${mongodb.password}" /> 

I need to configure a connection pool. Can anyone guide, How to implement MongoDB connection pool with existing code?


Solution

  • Please check if the following helps https://dzone.com/articles/multiple-mongodb-connectors-with-spring-boot

    Also, a similar question seems to be asked Connection pooling in Spring Boot and mongo db