Error: querySrv ECONNREFUSED MongoDB

Hi, I just updated my Node.js from version “16.something” to “20.10.0” and while I am trying connect to MongoDB Atlas, my terminal is throwing following error:

Error: querySrv ECONNREFUSED
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:275:17) {
errno: undefined,
syscall: ‘querySrv’,
hostname: ‘’

I am already familiar with this topic - querySrv ECONNREFUSED

And yes, it solved my issue, but I am concerning about two things:

  1. Driver version “2.2.12 or later” is tagged as Non Stable API - is it okay?
  2. When my Node.js was at version “16.something”, everything worked fine. So the question is about that issue is somewhere at Node.js itself if everything worked on older version.

Despite that I attempted many options with my DNS configurations, such as ipconfig /flushdns or using and addresses but none of them solved this issue. I also attempted multiple PC restarts, start the server at safe mode with networking and also tried different device on the same network. By the way I am using mongoose package and even upgrading it via npm, it neither helped. Any clues?

Feel free to ask some other details.

The post is recommending that the connection string from that dropdown is used it is not implying that versions is used nor does it actually impact whether Stable API is used or not.

Any version of the driver less than 3.7 does not support Stable API which is why it appears in the dropdown.

You should use the latest driver avaialable for your version of NodeJS.

If you are interested you can read about Stable API at the following doc links:

With tons of reinstalls of Node.js I discovered that problem starts to appear from version 19.7.0 and up. On the previous version (19.6.1) and down all is working fine.

I hope for more answers here, maybe @Jason_Tran have some new ideas?