{"id":24568898,"url":"https://github.com/bitliner/mongodbpopulator","last_synced_at":"2026-02-17T15:32:06.058Z","repository":{"id":10084588,"uuid":"12142581","full_name":"bitliner/MongoDbPopulator","owner":"bitliner","description":"It lets load fixtures for MongoDB on NodeJS. The fixtures can be specified as json files in a folder, or as Javascript objects.","archived":false,"fork":false,"pushed_at":"2015-06-11T14:33:13.000Z","size":1368,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T14:55:38.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitliner.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2013-08-15T20:01:21.000Z","updated_at":"2016-04-01T11:33:51.000Z","dependencies_parsed_at":"2022-09-01T05:41:24.292Z","dependency_job_id":null,"html_url":"https://github.com/bitliner/MongoDbPopulator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FMongoDbPopulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FMongoDbPopulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FMongoDbPopulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitliner%2FMongoDbPopulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitliner","download_url":"https://codeload.github.com/bitliner/MongoDbPopulator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243978926,"owners_count":20378119,"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":[],"created_at":"2025-01-23T14:55:41.219Z","updated_at":"2026-02-17T15:32:06.028Z","avatar_url":"https://github.com/bitliner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"MongoDbPopulator\n================\n\nIt lets to load fixtures for MongoDB on NodeJS. The fixtures can be specified as json files in a folder, or as Javascript objects.\n\n# Install\n\n```\nnpm install mongo-db-populator\n```\n\n# Fill the database by Javascript object\n\n1. Import the module\n```\nvar DbPopulator=require('mongo-db-populator')\n```\n\n2. Create an object whose keys are the collection names, the values are arrays representing the objects to be load\n```\nvar collectionsToBeLoaded={\n\tgreetings: [{\n\t\t'g1': 'ciao'\n\t}, {\n\t\t'g2': 'ola'\n\t}]\n}\n```\n\n3. Initialize  DbPopulator (specifying the parameters for the mongodb connection and the data to be loaded) and execute it\n```\nnew DbPopulator({\n\tdatabaseName: 'dbPopulatorTest',\n\tdata: collectionsToBeLoaded,\n\tuser: 'user',\n\tpassword: 'pwd'\n}).execute().then(function(){\n\tconsole.log('Done!')\n})\n```\n\n# Fill the database by js files\n\nLike the previuos example, but in the point 3 specify the `data` parameter as a string representing the path to the folder containing data to be loaded. Example:\n\n```\nnew DbPopulator({\n        databaseName: 'dbPopulatorTest',\n        data: path.resolve('./fixtures'),\n        user: 'user',\n        password: 'pwd'\n}).execute().then(...)\n```\nwhere the folder './fixtures' contains js files.\n\nAn example of the content of a js file is:\n\n```\nmodule.exports.greetings=[{\n\t\"g1\": \"ciao\"\n}, {\n\t\"g2\": \"ola\"\n},{\n\t\"g3\": \"hi\"\n}]\n```\n\nCheck the test cases to see details about the examples.\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitliner%2Fmongodbpopulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitliner%2Fmongodbpopulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitliner%2Fmongodbpopulator/lists"}