mongoose-dependent-seed
v0.6.1
Published
<div align="center">
Downloads
4
Readme
mongoose-dependent-seed :seedling:
Install
npm install mongoose-dependent-seed
yarn add mongoose-dependent-seed
Description
Mongoose database seeder - using your model dependency graph
Usage
seed.js
import Dependency from './dependency.model.js';
export default {
dependencies: [Dependency],
seed: deps => [
{
dependency,
...rest
}
]
}
model.js
import createSeed from 'mongoose-dependent-seed';
import seed from './seed.js';
const Schema = new Schema({...});
export default createSeed('Model', Schema, seed);
app.js
import { seed } from 'mongoose-dependent-seed';
try {
await seed();
{ ... }
} catch(error) { ... }