Could not establish database connection Nodejs

I can’t seem to connect to my database from my node app, which was just working fine a few hours back. The env is configured fine. I have tested with mongo compass and it works fine, so I’m not sure what to do.

Here’s index js file: