0.1.3 • Published 9 years ago

mongoose-load-fixtures v0.1.3

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

Mongoose fixtures loader

Build Status Dependency Status

This fixture loader is a rewrite of from https://github.com/powmedia/mongoose-fixtures to pass inserted items to callback, be a bit more flexible about fixtures input formats, and use dropCollection OR emptyCollection as an option.

Syntax : loadFixtures(fixturesObject, opts, cb)

fixturesObject is an object {ModelName: fixtures, ModelName: fixtures, ...}

For each model, fixtures can be :

opts can be:

  • db : mongoose connection to use
  • perCollectionLimit : max concurrent collections to process
  • perDocumentLimit : max concurrent document (PER COLLECTION) to process

TODO: if cb is null, a promise should be returned TODO: add options to drop / empty / keep collection TODO: check indexes