It doesn't work but now it works?

I’m using MongoDB Atlas for my nestjs project. It works fine when I first started, I can add, retrieve and delete data. I fell asleep with my laptop open and when I try to run my application again I got this error,

ERROR [MongooseModule]
Unable to connect to the database.

I tried restarting my laptop, my internet connection is good, my IP address is also good, my cluster is still running and I haven’t touch any lines of code that has anything to do with the DB connection. The data before the error is still there. It’s been two days and I’m honestly so lost.

But just before I post this, I change the password of the Database Access user just to make sure I’ve done all the possibilities before I ask here. So now it’s solved but I still would like to know why it suddenly does not work and I have to change the password to make it work. Thank you for your time.