saeedjalalisj / cleaner

Gives you methods to clear your Mongo database and collections for testing purposes

Home Page:https://atmospherejs.com/xolvio/cleaner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xolv.io Cleaner

This package clears your entire database for testing purposes.

Get the Book

To learn more about testing with Meteor, consider purchasing our book The Meteor Testing Manual.

Your support helps us continue our work on Velocity and related frameworks.

Installation

meteor add xolvio:cleaner

Usage

resetDatabase only resets your database when it is executed inside a debugOnly environment.

You can clear your database with resetDatabase(options, callback). It works on both the client and the server.

1.3

import { resetDatabase } from 'meteor/xolvio:cleaner';

// delete all collections with optional callback
resetDatabase(null, callback);

Pre 1.3

var cleaner = Package['xolvio:cleaner'];

// delete all collections with optional callback
cleaner.resetDatabase(null, callback);

Don't reset certain collection

1.3

import { resetDatabase } from 'meteor/xolvio:cleaner';

// delete all collections except myCollection with optional callback
resetDatabase({excludedCollections: ['myCollection']}, callback);

Pre 1.3

var cleaner = Package['xolvio:cleaner'];

// delete all collections except myCollection with optional callback
cleaner.resetDatabase({excludedCollections: ['myCollection']}, callback);

About

Gives you methods to clear your Mongo database and collections for testing purposes

https://atmospherejs.com/xolvio/cleaner

License:MIT License


Languages

Language:JavaScript 100.0%