MongoDB C Driver refusing connection


I am working on integrating my app with mongodb. Coming straight from the tutorial at and getting this error:

No suitable servers found (serverSelectionTryOnce set): [connection refused calling hello on ‘localhost:27017’]

Using WSL2 Ubuntu on windows.
Not a newbie to mongo though. I have been using it extensively for webapps. I have checked if mongo is running using

C:\WINDOWS\system32> mongod

and it is running just fine. So I think the issue is with mongoc driver. The installation is also correct. No other errors.

Kindly help me out. I want to do just simple CRUD operations.

Hello @Z.O.E_N_A ,

Welcome to The MongoDB Community Forums!

I notice you haven’t had a response to this topic yet - were you able to find a solution?
If not, could you please try below?

  • Try connecting to your local database using some other means like mongo shell
  • Try connecting your application using Atlas URI for testing to check if driver is working as expected

Also please provide version of MongoDB and driver version used.


Yes, I changed from localhost to

1 Like

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