@a4xrbj1/xolvio-cleaner
v1.0.0
Published
Gives you methods to clear your Mongo database and collections for testing purposes
Readme
xolvio-cleaner
Methods to clear your Mongo database and collections for testing purposes.
A maintained fork of xolvio:cleaner, kept
current for Meteor 3.x and published to npm under the @a4xrbj1 scope.
Installation
npm install @a4xrbj1/xolvio-cleanerUsage
resetDatabase only runs inside a development environment — it throws
otherwise. It works on both the client and the server, and is async, so always
await it.
import { resetDatabase } from '@a4xrbj1/xolvio-cleaner';
// empty every application collection
await resetDatabase();system.* (MongoDB-internal, e.g. system.profile) and velocity*
(test-runner) collections are always skipped — they are never emptied.
Provide a specific database instance
await resetDatabase({ db: yourDatabaseInstance });Don't reset a certain collection
await resetDatabase({ excludedCollections: ['myCollection'] });License
MIT. See LICENSE.
