Mongoose 3.1.0: Why the callback in the connection.db.dropDatabase(callback) is never called?

Posted by Totty on Stack Overflow See other posts from Stack Overflow or by Totty
Published on 2012-08-31T14:01:18Z Indexed on 2012/08/31 15:39 UTC
Read the original article Hit count: 174

Filed under:
|
|

Code:

var connection = mongoose.createConnection('mongodb://localhost:9000/' + databaseName);
connection.db.dropDatabase(function(err){
    // never reach this point!
    debugger;
    console.log(err);
    console.log('-------------->Dropped database: ' + databaseName);
});

If I do connection.open it says that it's already opening and no multiple calls to "open" are supported for the same connection.

Even this doesn't work

var conn = mongoose.createConnection('mongodb://localhost',databaseName, 9000, {}, function(){
    console.log('created'); // is reached
    conn.db.dropDatabase(callback); // but the callback is not called anyway
});

What is the problem? ("mongoose": "3.1.0")

thanks

© Stack Overflow or respective owner

Related posts about callback

Related posts about mongoose