Seed MongoDB databases with seed data using Mongoose models. Version 2.1.6 is the latest stable release; the package has had irregular updates with last release in 2020. It provides a CLI (md-seed) to generate and run seeders, supports dropping the database before seeding, and allows ordering of seeders. Compared to alternatives like mongoose-seed, it offers a Seeder class with shouldRun and run methods, and integrates with semantic-release for versioning.
npm install mongoose-data-seedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a basic seeder class extending Seeder, implement shouldRun/run, and export default.
Update seeders to extend Seeder class and export default; configure md-seed-config.js with named exports.
Backup your project before running init, or manually create configuration files.
Consider using a more modern seeding library like @casl/mongoose or custom scripts for mongoose 6+.
Use Node >=8 or configure Babel for ES modules; alternatively use require syntax.
Run npm install --save mongoose-data-seed and ensure package.json contains it.
Use import { Seeder } from 'mongoose-data-seed'.