A simple JSON fixture loader for MongoDB on Node.js that supports loading test data from files, directories, or objects. Version 1.0.3 is the latest stable release with no active development. It provides a CLI tool for quick loading and a programmatic API with methods like load, clear, clearAllAndLoad, and clearAndLoad. Includes a createObjectId helper for managing document references. Differentiators include easy relationship management via keyed documents and support for modifiers. Compatible with Node >= 0.4.1.
npm install mongodb_fixturesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to a MongoDB database, clears the 'users' collection, then inserts two documents.
Set safe: true in options or ensure you use a callback to handle errors.
Pass explicit collection names to clear only specific collections.
Migrate to a modern alternative like 'mongodb-memory-server' or 'mongod' for fixture loading.
Run as: mongofixtures <dbname> <host> <fixture file>
Use const fixtures = require('pow-mongodb-fixtures').connect('dbname');Start mongod or specify correct host/port in options.