I'm learning Node.js and just started working with MongoDB.
I'm making a connection with the MongoDB Cluster I've created
const dbURI = 'mongodb+srv://testuser:[email protected]/mydb?retryWrites=true&w=majority';
mongoose.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true })
.then((result) => console.log('connected to db'))
.catch((err) => console.log(err));
When I run it nodemon app
I get this error:
Error: querySrv ENOTFOUND _mongodb._tcp.mydb.fzofb.mongodb.net at QueryReqWrap.onresolve [as oncomplete] (node:dns:206:19) { errno: undefined, code: 'ENOTFOUND', syscall: 'querySrv',
hostname: '_mongodb._tcp.mydb.fzofb.mongodb.net' }