我正在尝试将 MongoDB atlas 实例连接到 nodejs/express 服务器:
const mongoose = require("mongoose");
const dbURI =
"mongodb+srv://(url copied from atlas connect)";
const options = {
useNewUrlParser: true,
dbName: "data"
};
mongoose.connect(dbURI, options).then(
() => {
console.log("Database connection established!");
},
err => {
console.log("Error connecting Database instance due to: ", err);
}
);
但我不断收到以下错误:
MongoNetworkError:连接 5 到集群 ... 27017 在 TLSSocket 处关闭。...
我怎样才能解决这个问题?