Node not connecting to Mongo more than once

被刻印的时光 ゝ 提交于 2019-12-06 09:20:59

The problem was that "npm install mongoose" didn't install the proper version of Mongoose. Once I edited the package.json to the most recent version, everything worked fine.

I have used this little snippet to close my connections to MongoDB before terminating the app:

process.on('SIGINT', function() {
    mongoose.close(function(){
        process.exit();
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!