I keep one instance of MongoClient and DB in my application, and every time I want to perform some operation, I call getCollection() .
I am wondering if you need to explicitly close the connection, just like connection.close() in JDBC.
To emphasize, I have only one instance of MongoClient . My question is not closing MongoClient , but closing the connections, which I think opens when I call getCollection() .
java mongodb
danieln
source share