Seed MongoDB databases with JSON data using Mongoose models. Version 1.2.1 allows seeding from JSON files, automatically resolving model references. Supports promises and callbacks. Options control whether to drop the entire database, drop only seeded collections, or append data. Last updated 2015; no active maintenance. Simpler than faker-based seeders but lacks advanced features like auto-increment or relationships.
npm install mongoose-seederVerified import paths — ran on the pinned version, not inferred.
Seeds a MongoDB database with a User document from JSON data, dropping the entire database first.
Consider alternatives like mongodb-seeding or mongoose-dummy-seeder.
Use meaningful keys; they are preserved in the returned dbData object.
Call mongoose.connect() and ensure models are registered before calling seeder.seed().
Set options { dropDatabase: false } or { dropCollections: true } to preserve existing data.Use 'const seeder = require('mongoose-seeder')' (no .default).Ensure 'User' model is defined with mongoose.model('User', schema) before seeding.Define all models before calling seed().