Yes, although you do it via the native MongoDB driver and not Mongoose itself. Assuming a required, connected, mongoose variable, the native Db object is accessible via mongoose.connection.db, and that object provides dropCollection and dropDatabase methods.
// Drop the 'foo' collection from the current database
mongoose.connection.db.dropCollection('foo', function(err, result) {...});
// Drop the current database
mongoose.connection.db.dropDatabase(function(err, result) {...});
Mongoose references the connection on every model. So, you may find it useful to also drop the DB or collection off of an individual model.
For example:
// Drop the 'foo' collection from the current database
User.db.dropCollection('foo', function(err, result) {...});
// Drop the current database
User.db.dropDatabase(function(err, result) {...});
For those that are using the mochajs test framework and want to clean all db collections after each test, you can use the following which uses async/await:
afterEach(async function () {
const collections = await mongoose.connection.db.collections()
for (let collection of collections) {
await collection.remove()
}
})