mongoose-dummy-seeder
v1.1.0
Published
Mongo-dummy faker based seeder package helps easily seed dummy data generated by mongo-dummy.
Downloads
2
Maintainers
Readme
mongoose-dummy-seeder
Mongo-dummy faker based seeder package helps easily seed dummy data generated by mongo-dummy.
Installation
$ npm install --save-dev mongoose-dummy-seeder
Configuration
Create .env file in the root folder and insert written below
MONGO_HOST = mongodb://localhost:27017 //your mongodb host and port
MONGO_DB = database_name //your database name
Inside scripts in package.json add
"seeder": "node node_modules/mongoose-dummy-seeder/index.js"
Usage
create new seed
Inside root folder of your project run
$ npm run seeder
then run
seeder $ create-seed filename
seed will be created inside src/seeds folder
seed the seed file
open the created seed inside src/seeds
import your mongoose model
eg
const model = require('path-to-your-model');
add ignorable fields in the ignoredFields array
const ignoredFields = ['_id','__v'];
and edit number_of_dummy_data
const number_of_dummy_data = 10;//as much as you want
after that run
seeder $ seed filename