Note: I understand that there is a similar question about SO , but it talks about the old version of Casbah, plus, the behavior explained in the answer is not what I see!
I got the impression that Casbah MongoClient processed the connection pool. However, in my process, I see a large and growing number of mongodb connections, which makes me doubt that this pool really exists.
Basically, this is what I am doing:
class MongodbDataStore { val mongoClient = MongoClient("host",27017)("database") var getObject1(): Object1 = { val collection = mongoClient("object1Collection") ... } var getObject2(): Object2 = { val collection = mongoClient("object2Collection") ... } }
So, I never close MongoClient.
Should I close it after every request? Implement my own pool? What then?
thanks
source share