querySrv EREFUSED _mongodb._tcp.cluster0.tpvpc.mongodb.net

After changing the password and the ‘test’ name to my password and database, while connecting to my database from compass it throws this error.
Not just compass, also when am trying to connect from my application with its corresponding connection string, am having the same error.
The error which keeps on coming is :
querySrv EREFUSED _mongodb._tcp.cluster0.tpvpc.mongodb.net

Thanks A2A :slight_smile:

Is your IP address correctly whitelisted?

I faced a similar issue while using MongoDB on Windows. What worked for me simply using a different internet connection. Like on switching to mobile hotspot it worked. Maybe there are some ISP level related

1 Like


I have been experience the same issue on my project but I managed to resolve by changing node version see below image.

Filename - Posts.js

const express = require("express");

const mongodb = require("mongodb");

const router = express.Router();

// Get Posts

router.get("/", async (req, res) => {

  try {

    const posts = await loadPostsCollection();

    res.send(await posts.find({}).toArray());

  } catch (e) {




async function loadPostsCollection() {

  const client = await mongodb.MongoClient.connect(



      useNewUrlParser: true,

      useUnifiedTopology: true,



  return client.db("posts_db").collection("posts");


module.exports = router;

Lemme know if this help!


1 Like