Connection pooling in node-mongodb-native, when to call db.open and db.close Connection pooling in node-mongodb-native, when to call db.open and db.close express express

Connection pooling in node-mongodb-native, when to call db.open and db.close


I suggest to use generic-pool

It's very clear and pretty straightforward, you define how to open connection, how to close, and size of the pool. The module takes care of the rest, creating new connections as needed, and disposing unused connection after timeout you also select.

I use the module with every resource I need to pool, so I dont have to bother with custom pooling API every time.


This is the best answer I could find. Apparently, it works automatically, but I'm still figuring out the details.

Let me know if you find anything!

http://technosophos.com/node/255