Trying to connect my express app with mongodb atlas, but I keep getting this MongodbNetworkError
Server.js file
const express = require("express") const mongoose = require("mongoose") const dotenv = require("dotenv") dotenv.config() const app = express() mongoose .connect(process.env.MONGODB_KEY, { useNewUrlParser: true, useUnifiedTopology: true }) .then(() => console.log("MongoDB connected")) .catch(err => console.error(err)) const PORT = process.env.PORT || 5000 app.listen(PORT, () => console.log(`Server running on port ${PORT}`)) Command Line
[nodemon] starting `node server.js` Server running on port 5000 { Error: getaddrinfo ENOTFOUND coolcluster-shard-00-00-wqaqv.mongodb.net coolcluster-shard-00-00- wqaqv.mongodb.net:27017 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26) name: 'MongoNetworkError', errorLabels: [ 'TransientTransactionError' ], [Symbol(mongoErrorContextSymbol)]: {} }