MongoDB refuses to connect

My MongoDB server just wont connect to my API even though its accessible by all IPs.

its running perfectly on both Heroku and and my local system.

I am unable to diagnose it properly I am new to web-development and this is the first time I encountered this issue. but I am pretty sure it has something to do with error while connecting with mongoDB

pasting the screenshots explaining why i am suspecting this

i created a flag to check if connection with server is successful

Then i sent different responses on home route depending on flag (" / ")

And then the response i get on home route is that db is not connected-

Can someone please help i need this urgently my project deadline is coming up soon :smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:

If it’s on free tier and on a sleep state, you may be suffering with that problem: https://community.render.com/t/my-app-url-is-loading-infinitely/

No it’s loading but not connecting to db it’s showing the error and that’s only possible if the app was loading

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.