vadimdemedes / mongorito

🍹 MongoDB ODM for Node.js apps based on Redux
1.38k stars 90 forks source link

How to check the current state of the connection with the database? #218

Open sanslash332 opened 4 years ago

sanslash332 commented 4 years ago

I'm using this awesome library in a small microservice to connect to mongo and control some documents on it; but, the microservice deppends directly of this connection, so if the connection if dropped, instead of have a constant answer of http 500 or something other controlled error, I want to dettect if the connection was dropped, and throw an exception to destroy the ms.

So, how to I can check the connection state?

Thanks :)