I cannot connect to mongodb. Please help from everyone

Hi @Hung_Viet, try changing your connection string to mongodb://127.0.0.1:27017. It’s possible you’re having the same issue as what was reported in NODE-4678.

i tried your way but still can’t use mongodb. mongodb is really hard to connect

@Hung_Viet the connection string you shared assumes you have an instance of MongoDB running locally. If this is your first time using MongoDB it might be beneficial to setup a free cluster using MongoDB Atlas and follow the 5 steps outlined in the documentation.

This will walk you through getting started and connecting your application to your cluster.

1 Like

@alexbevi
I tried many ways but can’t connect and i also tried connecting via mongodb website but still no result

What do you mean by MongoDB website? I believe it is a local implementation. If so, what is the underlying OS? The error message is clear that the connection to this port is refused. It might be the OS is refusing connection to this port or you have configured Mongod to a non-default port or the mongod service is not running on the localhost. There can be multiple reasons.

To help investigating further, let us know what is the underlying OS?

Regards,
Abdullah Madani

@Abdullah_Madani
How can I get in touch with you? This is my first time learning and implementing MongoDB, it has too many errors. Do you have free time to answer? Thank you.

Don’t worry! We are one community. You can post the errors one by one, starting for the top most one. For this issue, please reply to my previous queries to help start investigating further and have a better idea of your setup

@Abdullah_Madani
I have seen how to connect on youtube but now I can only connect to mongodb but now the teacher requires me to have the skills to create a book selling page with mongodb ! Do you have free time to help me?
Thank you !

Excellent!!! Glad to know that now you are able to connect.

I advise you to start a new thread for this, as the issue in the current thread has been resolved now. This will help us maintain clean threads and will help you also to draw right expertise to address your concerns.

@Abdullah_Madani
ALRIGHT ! I will create a new topic but I really need your help and everyone!
Thank you!