node.js - 【mongodb · mongoose】错误 "Topology was destroyed" 怎么解决?
怪我咯
怪我咯 2017-04-17 16:10:13
0
2
813
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
PHPzhong

Solved, the problem is that the database is disconnected and needs to be reconnected. I introduced it in the following blog:
Solution

伊谢尔伦

I have never encountered a similar error, but I searched stackoverflow and found posts with similar problems:

http://stackoverflow.com/ques...

The problem is probably related to the instability of the network, so one method in the post is to modify the connect options:

var options = {
server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } },
replset: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } } }
};
mongoose.connect(secrets.db, options);

For reference.

Have a great weekend!


Love MongoDB! Have Fun!


Save RP

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template