小编Fah*_*mad的帖子

MongoNetworkError:连接 3 到 cluster0-shard-00-02-z0urk.mongodb.net:27017 已关闭

{ MongoNetworkError: connection 3 to cluster0-shard-00-02-z0urk.mongodb.net:27017 在 TLSSocket 关闭。(/home/fahad/Personal Work/Nodejs/Node js start/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:352:9) 在 Object.onceWrapper (events.js:276:13)在 TLSSocket.emit (events.js:188:13) at _handle.close (net.js:610:12) at TCP.done (_tls_wrap.js:386:7) name: 'MongoNetworkError', errorLabels: [ 'TransientTransactionError ' ],
[Symbol(mongoErrorContextSymbol)]: {} }

module.exports = (app, express , mongoose, path, bodyParser) => {

    app.use(express.static(path.resolve(__dirname, "../../dist")));
    app.use(bodyParser.json());


    mongoose.connect('mongodb+srv://fahad:123@cluster0-z0urk.mongodb.net/test?retryWrites=true', {useNewUrlParser: true})
    .then(()=>console.log("DB server connect"))
    .catch(e => console.log("DB error", e));
};
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js reactjs server

2
推荐指数
1
解决办法
2778
查看次数

标签 统计

mongodb ×1

mongoose ×1

node.js ×1

reactjs ×1

server ×1