vadimdemedes / mongorito

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

[docs] Keep connection alive? #153

Closed gpa closed 7 years ago

gpa commented 7 years ago

Hello, I was wondering whether I should keep a single connection to the database alive or whether to open and close connections on every client request? If I keep it alive, will there any events be fired in case the connection gets interrupted? I know that mongoose has a auto-reconnect feature. Is there anything similar in mongorito?

vadimdemedes commented 7 years ago

Yes, you only keep initialize Mongorito once when your app starts up.

mongoose has built-in re-connection feature, I haven't found anything similar in mongorito. Will there any events be fired? Please explain! Thanks!

Just got down to implementing it, and found out that mongodb driver reconnects automatically. Wonderful!