A utility to drop all non-system collections from a MongoDB database. Version 2.0.0 is stable, with infrequent releases. It is designed specifically for test setup/teardown, accepting a MongoDB URI and returning a cleanup function. Unlike generic drop-database tools, it preserves system collections and integrates easily with Mocha's beforeEach.
npm install drop-mongodb-collectionsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows ESM import, factory usage with env URI, and Mocha integration.
Use ESM import syntax or pin to v1.x if CJS required.
Store return value and reuse it.
Upgrade to v2 and use await or .then.
Use import instead, or downgrade to v1.
Grant dropDatabase role to the MongoDB user.