Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sharongrossman/mongoose-dependent-seed
Mongoose database seeder - using your model dependency graph
https://github.com/sharongrossman/mongoose-dependent-seed
dependency graph mongoose node seed
Last synced: 7 days ago
JSON representation
Mongoose database seeder - using your model dependency graph
- Host: GitHub
- URL: https://github.com/sharongrossman/mongoose-dependent-seed
- Owner: SharonGrossman
- License: mit
- Created: 2019-08-22T17:01:15.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T08:03:08.000Z (almost 2 years ago)
- Last Synced: 2024-10-28T15:23:20.029Z (21 days ago)
- Topics: dependency, graph, mongoose, node, seed
- Language: JavaScript
- Homepage:
- Size: 965 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongoose-dependent-seed :seedling:
![BuildStatus](https://travis-ci.org/SharonGrossman/mongoose-dependent-seed.svg?branch=master) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)## 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) { ... }
```
## License[MIT](LICENSE) © [Sharon Grossman](https://github.com/sharongrossman)