Wednesday, April 6, 2016

trying to open unclosed connection

When having the error, the first thing to do is to restarting your mongo database.
If the error still persist, chances are that your connection statement is as below:

var dbUrl= 'mongodb://localhost:27017/test';
mongoose.connect(dbUrl);

To solve it , change connect to createConnection

var dbUrl= 'mongodb://localhost:27017/test';
mongoose.createConnection(dbUrl);


It should be working now, if not drop me a comment and will come to your rescue...


No comments:

Post a Comment