1.0.0 • Published 8 years ago

kl-mongo-fixture-loader v1.0.0

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
8 years ago

kl-mongo-fixture-loader

Installation

This module is installed via npm:

npm install mongo-fixture-loader

Usage

Requires a mongoose or a native mongodb connection You must deal with the connection lifecycle externally in your app (i.e. open/close connection)

import { FixturesUtil } from 'mongo-fixture-loader';
const fixtures = new FixturesUtil(connection);

To refresh the data (both remove and seed)

fixtures.refresh();

To seed the data

fixtures.seed();

To remove the data

fixtures.remove();

To inspect the data

console.log(fixtures.cachedBson.User[0]._id) // prints some _id
1.0.0

8 years ago