Interface MongoCleanerOptions

The options of the mongo-cleaner clean function.

Hierarchy

  • MongoCleanerOptions

Properties

dropDatabases?: boolean

If you want to drop the whole database.

NB: The admin database cannot be dropped and is ignored.

Default: true

emptyCollections?: boolean

If you want to empty collections without dropping them and their databases. If both "emptyDatabases" and this options are true, this option will be used as a fallback if a collection drop fails.

NB: If "dropDatabases", "emptyDatabases" and "emptyCollections" are all false, this option will eventually become true.

Default: false

emptyDatabases?: boolean

If you want to drop databases' collections without dropping the databases. If both "dropDatabases" and this options are true, this option will be used as a fallback if a database drop fails.

Default: false

keep?: string | RegExp | ((db: string) => boolean) | (string | RegExp | ((db: string) => boolean))[]

A string, a RegExp, a function or an array of both specifying databases that will not be cleaned.

Default: []

log?: boolean

If you want to display the clean method's log on console.

Default: false

noConfirm?: boolean

If you want the method to skip asking confirm before cleaning the MongoDB.

Default: true

numberOfRetries?: number

The number of times a drop or empty operation is retried before throwing an error or passing to a fallback.

Default: 1

retryMilliseconds?: number

The number of milliseconds between two attempts of a drop or empty operation.

Default: 20

throwIfNotTotal?: boolean

If you want to throw a MongoCleanerCleanError when MongoDB is only partially cleaned.

Default: false

Generated using TypeDoc