简体   繁体   中英

mongoose.connect - Doesn't fire callback (mlab)

Starting a couple of days ago, I started having an issue connecting to my mlab hosted MongoDB instance. There have been no code changes and it still works on my other laptop as well as my teammates computer. The below code produces no output - I assume this means the request is getting lost somewhere. Any suggested steps to debug this would be much appreciated!

mongoose.connect('mongodb://user:pass@ds123456.mlab.com:12345/dbname', function(err){
    if(err){
        console.log("Failed to connect to database");
    }
    else {
        console.log("Successfully connected to database");
    }
});

UPDATE

Turns out that I was using Mongoose version 3.8.0 . Updating Mongoose resolved the issue.

Still not sure why it only broke on this computer but maybe this solution will help someone!

Turns out that I was using Mongoose version 3.8.0 . Updating Mongoose resolved the issue.

Still not sure why it only broke on this computer but maybe this solution will help someone!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM