mongodb connection statuses are not listened to, as the listeners are defined after `mongoose.connect()`
If setting up the MongoDB server initially, errors out, the error is not logged as the listeners are defined after the mongoose.connect()
. This means that if the connection fails when the server is started, the listener is not notified. This is a very minor issue. But logging helps less experienced devs know if the MongoDB connection has been established correctly or not.
If the connection is not established, all queries end up throwing errors and as there is no explicit error-specific error handling in place, the logic flow of the controllers fails.
Edited by Ashwin Prasad