Mongoose Trying to open unclosed connection

前端 未结 6 450
离开以前
离开以前 2020-12-24 05:38

This is a simplified version of the problem, but basically I\'m trying to open 2 mongodb connections with mongoose and it\'s giving me \"Trying to open unclosed connection.\

6条回答
  •  时光取名叫无心
    2020-12-24 06:29

    To add on Raghuveer answer :

    I would also mention that instead of using mongoose directly (you are probably using it this way you end up on this post) :

    require('mongoose').model(...);
    

    You would use the returned connection :

    var db = require('mongoose').connect('xxx', 'yyy');
    db.model(...);
    

提交回复
热议问题