I can not connect my mongodb compass with my cluster

Sorry for the confusion, I always forget that Windows is using Network Connections rather than network interface.

In the image at I can not connect my mongodb compass with my cluster - #16 by Jimmy_h_Vu, with Control Panel > Network and Internet > Network Connections, you have 3 icons. One of them is partly covered by the dialog Ethernet Properties. The other 2 are labeled McAfee VPN and Wi-Fi. For the McAfee VPN the status shows a big red X with Network cable unplugged. The Wi-Fi one also show a big red X with Not connected.

In the other image at I can not connect my mongodb compass with my cluster - #18 by Jimmy_h_Vu, you show the DNS setting Network & internet > Wi-Fi > Wi-Fi but you are Not connected via that connection as explained in the previous paragraph.

This means you DID NOT changed the DNS setting of the network connection you are using.

The solution is to change the DNS setting of the network connection you are using to connect to your cluster.

1 Like

Hi Steeve,
Thanks for your Information and I have connected mongodb compass with the cluster.
but
I have another problem to connect my application with the cluster.

my server.js

const express = require("express");

const mongoose = require("mongoose");

const cors = require("cors");

const { readdirSync } = require("fs");

const dotenv = require("dotenv");

dotenv.config();

const app = express();

app.use(cors());

//routes

readdirSync("./routes").map((r) => app.use("/", require("./routes/" + r)));

//database

mongoose

  .connect(process.env.DATABASE_URL, {

    useNewUrlParser: true,

  })

  .then(() => console.log("database connected successfully"))

  .catch((err) => console.log("error connecting to mongodb", err));

const PORT = process.env.PORT || 8000;

app.listen(PORT, () => {

  console.log(`server is running on port ${PORT}..`);

});
  • The terminal errors:
server is running on port 8000..
error connecting to mongodb MongoParseError: mongodb+srv URI cannot have port number
    at new ConnectionString (C:\Users\vujim\OneDrive\Desktop\jvuwithjesus\backend\node_modules\mongodb-connection-string-url\lib\index.js:146:23)
    at parseOptions (C:\Users\vujim\OneDrive\Desktop\jvuwithjesus\backend\node_modules\mongoose\node_modules\mongodb\lib\connection_string.js:213:17)
    at new MongoClient (C:\Users\vujim\OneDrive\

************Please help!!!

If you have linux or cygwin you can use the following:
dig +all vuwithjesus.ygys3.mongodb.net

; <<>> DiG 9.10.6 <<>> +all vuwithjesus.ygys3.mongodb.net

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 25811

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 4096

;; QUESTION SECTION:

;vuwithjesus.ygys3.mongodb.net. IN A

;; AUTHORITY SECTION:

mongodb.net. 900 IN SOA ns-761.awsdns-31.net. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 60

;; Query time: 122 msec

;; SERVER: 10.0.0.138#53(10.0.0.138)

;; WHEN: Sun May 29 12:35:21 IDT 2022

;; MSG SIZE rcvd: 153

if the DNS resolves correctly then you still need the right username and password, but at least you are knocking at the right door!

1 Like

The error message is

The error is in your URI. You have to share your URI for us to help you figure out what is wrong.

1 Like


That work fine for me

I too facing this issue