Search code examples
node.jsmongoosebluebird

Mongoose 4.11.0 Promises timing out


I'm using mongoose and bluebird. The setup is by-the-book, and is using the useMongoClient option, as requested by the notification.

Mongoose.connect(myConnectionString, {useMongoClient: true});

however none of the promises I use execute.


Solution

  • var mongoose = require('mongoose');
    mongoose.connect('mongodb://localhost/starbucks', { useMongoClient: 
    true });
    var db = mongoose.connection;
    db.on('error', console.error.bind(console, 'connection error:'));
    db.once('openUri', function() {
    // we're connected!
    });
    

    I have used this code for latest version and warning has gone. Please try it. Or use older version.