MongoServerSelectionError: getaddrinfo ENOTFOUND

I followed the article you wrote but I’m getting this error message .

MongoServerSelectionError: getaddrinfo ENOTFOUND

Welcome to the MongoDB community @Penuel_Nwaneri !

The getaddrinfo ENOTFOUND error indicates that the hostname you have provided for your MongoDB deployment cannot be resolved by the client you are using.

I would double-check the details in your connection string and try to ping that hostname from the command line to verify the name can be resolved to an IP address.

If you are still having trouble connecting, please share some more details including:

  • where your cluster is deployed (self-hosted, MongoDB Atlas, other …)

  • O/S version you are connecting from

  • confirmation that the ping command is able to resolve the hostname for your MongoDB deployment to an IP address

If this is a newly created deployment and DNS hostname, there may be a delay before the DNS information propagates through to your local DNS resolver. You may want to try changing your DNS servers to one of the public DNS services like Google Public DNS or Cloudflare public DNS.


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