Hey guys. I am using mongodb with my nodejs application, and I am keeping receiving this connection closed error:
“connection x to IP:27017 closed”
Every once in a while I am getting this error. I dont know if this is something happening on my code-setup (using nestjs with mongoose), or if is something configurable at atlas side.
Someone already had this error?
Edit: I already whitelisted the ips. I can connected but my app keep getting disconnected.
You can also implement error handling and connection retry logic in your Node.js application. This will help your application gracefully handle dropped connections and attempt reconnection.
Lastly, ensure that you are using a recent version of Mongoose, as newer versions often have improvements.
If you’ve checked all of the above and the issue still persists, it might be helpful to provide more information about your specific setup, how frequently you’re experiencing disconnections and code so that a more detailed analysis can be conducted. Additionally, check MongoDB’s logs for any related error messages that might provide more insight into the issue.