I'm developing an application in Java that connects with mongoDB with the mongoDB java driver. First of all I made mongoDB connection class in analogy with JDBC. It means that in one query app created new connection and after closed it. And in every query I create new MongoClient. And after close it. But not a long time ago in Mongo documectation I read that
The MongoClient instance actually represents a pool of connections to the database; you will only need one instance of class MongoClient even with multiple threads.
MongoClient.close() to clean up resources
I'm working with servlets. That is why I have multiple threads (in every thread I create new MongoClient).
Who can explain me should I change my code or there is no big difference between this ways?