Mongoose 4.6.0+:
mongoose.connect('mongodb://localhost/mydb')
mongoose.connection.once('connected', () => {
mongoose.connection.db.dropDatabase();
});
Passing a callback to connect won't work anymore:
TypeError: Cannot read property 'commandsTakeWriteConcern' of null