{"id":17293750,"url":"https://github.com/toymachiner62/node-mongo-seeds","last_synced_at":"2025-04-07T07:10:47.144Z","repository":{"id":16782744,"uuid":"19541090","full_name":"toymachiner62/node-mongo-seeds","owner":"toymachiner62","description":"A tool to quickly populate your mongo db from a set of .json files","archived":false,"fork":false,"pushed_at":"2021-03-17T11:29:39.000Z","size":913,"stargazers_count":144,"open_issues_count":4,"forks_count":41,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T05:07:57.151Z","etag":null,"topics":["mongodb","nodejs"],"latest_commit_sha":null,"homepage":"http://toymachiner62.github.io/node-mongo-seeds/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toymachiner62.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-07T16:04:56.000Z","updated_at":"2023-10-17T05:48:32.000Z","dependencies_parsed_at":"2022-07-13T13:51:19.655Z","dependency_job_id":null,"html_url":"https://github.com/toymachiner62/node-mongo-seeds","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toymachiner62%2Fnode-mongo-seeds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toymachiner62%2Fnode-mongo-seeds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toymachiner62%2Fnode-mongo-seeds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toymachiner62%2Fnode-mongo-seeds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toymachiner62","download_url":"https://codeload.github.com/toymachiner62/node-mongo-seeds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608151,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mongodb","nodejs"],"created_at":"2024-10-15T10:48:48.943Z","updated_at":"2025-04-07T07:10:47.118Z","avatar_url":"https://github.com/toymachiner62.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-mongo-seeds\n[![Build Status](https://travis-ci.org/toymachiner62/node-mongo-seeds.svg?branch=master)](https://travis-ci.org/toymachiner62/node-mongo-seeds)\n[![Code Climate](https://codeclimate.com/github/toymachiner62/node-mongo-seeds/badges/gpa.svg)](https://codeclimate.com/github/toymachiner62/node-mongo-seeds)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/0c613fd309e01cd2a790/test_coverage)](https://codeclimate.com/github/toymachiner62/node-mongo-seeds/test_coverage)\n\n\n\u003e A tool to quickly populate your mongo db from a set of .json files. The concept is very similar to Ruby on Rails idea of seeding a database. This allows a new developer to pull down the source code for a project (which contains .json files to populate their mongodb with) and run a command and bingo!! database populated and ready to rock.\n\n## Setup\n\n```sh\n$ npm install -g node-mongo-seeds\n```\n\n## Usage\n\n### seed-setup\nGenerate the setup file `seed.js`.\n\n- From the root of your project:\n\n\t```sh\n\t$ seed-setup\n\t```\n\n- Replace `\"localhost/LOCAL_DB_NAME\"` with the path to your mongodb in your brand new `seed.js` file\n\n- Create a `/seeds` folder in your project root and put `.json` files or `.js` files which **export a json object** in there.\n\t\tThe name of the file is going to be the collection name in mongo and the contents\n\t\tof the file will be populated into that mongo collection.\n\t- Note that this package supports the [mongo-extended-json syntax](https://docs.mongodb.com/manual/reference/mongodb-extended-json/)\n\n### seed\nSeed your mongodb with all your data from your `/seeds` folder.\n\n- From the root of your project:\n\n\t```sh\n\t$ seed\n\t``` \n\t\n\t```sh\n\t$ seed --help\n\t\n\tUsage: seed [options]\n\n  Options:\n\n    -s, --seeds-folder [folder]  Use seeds folder [folder]\n    -h, --help                   output usage information\n\t```\n\n**Note**: Every time you run `$ seed` it will blow away all the data in your collections and re-populate them with whatever is in your `/seeds` directory.\n\n### Separate databases per NODE_ENV\n\nYou can have separate databases for each NODE_ENV that you are using. Just a put a line in `seed.js` for each `NODE_ENV` that you are going to use. It defaults to `undefined`, `dev`, and `prod` but can be changed to whatever.\n\n## Contributing\n\n1. Clone project and run `npm install -g ./` from project root\n2. Add feature(s)\n3. Add tests for it\n4. Submit pull request\n\n### Running Tests\n\nTo run the tests, follow these instructions.\n\n1. Start mongod process\t\t\n2. From project root `$ npm install`\n3. Run test command `$ npm test`\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoymachiner62%2Fnode-mongo-seeds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoymachiner62%2Fnode-mongo-seeds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoymachiner62%2Fnode-mongo-seeds/lists"}