kl-mongo-fixture-loader
v1.0.0
Published
Allows you to load and unload fixture data quickly from EJSON files which are easily modifiable
Downloads
9
Readme
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