Once I open the connection in the router function I can pass db object in request objects to next() function.
MongoClient.connect(client) { req.client=client; next(); }
Without closing the db connection I can pass it into next function and execute queries on the same db object.
The issue is I can't close idle connections that pile up I have tried using connectiontimeout, sockettimeout options but they wont work.
I don't want to open .connect and at the same time close it multiple times.
I want to open once use through out my application and close once.
Please help