{"id":14975746,"url":"https://github.com/lykmapipo/mongoose-faker","last_synced_at":"2025-10-27T14:31:12.311Z","repository":{"id":31866403,"uuid":"129096580","full_name":"lykmapipo/mongoose-faker","owner":"lykmapipo","description":"mongoose plugin to generate fake model data","archived":false,"fork":false,"pushed_at":"2023-01-09T01:25:51.000Z","size":1314,"stargazers_count":16,"open_issues_count":10,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T06:23:44.079Z","etag":null,"topics":["factor","faker","mongoose","nodejs","plugin","seed"],"latest_commit_sha":null,"homepage":null,"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/lykmapipo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2018-04-11T13:17:29.000Z","updated_at":"2025-01-20T20:51:25.000Z","dependencies_parsed_at":"2023-01-14T19:55:48.843Z","dependency_job_id":null,"html_url":"https://github.com/lykmapipo/mongoose-faker","commit_stats":null,"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-faker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-faker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-faker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykmapipo%2Fmongoose-faker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lykmapipo","download_url":"https://codeload.github.com/lykmapipo/mongoose-faker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238508815,"owners_count":19484208,"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":["factor","faker","mongoose","nodejs","plugin","seed"],"created_at":"2024-09-24T13:52:28.938Z","updated_at":"2025-10-27T14:31:11.914Z","avatar_url":"https://github.com/lykmapipo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoose-faker\n\n[![Build Status](https://app.travis-ci.com/lykmapipo/mongoose-faker.svg?branch=master)](https://app.travis-ci.com/lykmapipo/mongoose-faker)\n[![Dependencies Status](https://david-dm.org/lykmapipo/mongoose-faker.svg)](https://david-dm.org/lykmapipo/mongoose-faker)\n[![Coverage Status](https://coveralls.io/repos/github/lykmapipo/mongoose-faker/badge.svg?branch=master)](https://coveralls.io/github/lykmapipo/mongoose-faker?branch=master)\n[![GitHub License](https://img.shields.io/github/license/lykmapipo/mongoose-faker)](https://github.com/lykmapipo/mongoose-faker/blob/develop/LICENSE)\n\n[![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Code Style](https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)\n[![npm version](https://img.shields.io/npm/v/@lykmapipo/mongoose-faker)](https://www.npmjs.com/package/@lykmapipo/mongoose-faker)\n\nmongoose plugin to generate fake model data\n\n## Requirements\n\n- [NodeJS v13+](https://nodejs.org)\n- [Npm v6.12+](https://www.npmjs.com/)\n- [MongoDB v4+](https://www.mongodb.com/)\n- [Mongoose v6+](https://github.com/Automattic/mongoose)\n\n## Install\n```sh\n$ npm install --save mongoose @lykmapipo/mongoose-faker\n```\n\n## Usage\n\n```js\nimport mongoose from 'mongoose';\nimport mongooseFaker from '@lykmapipo/mongoose-faker';\n\nmongoose.plugin(mongooseFaker);\nconst { Schema } = mongoose;\n\nconst UserSchema = new Schema({\n  name: {\n    type: String,\n    fake: {\n      generator: 'name',\n      type: 'firstName',\n    },\n  },\n});\nconst User = mongoose.model('User', UserSchema);\n\nconst user = User.fake();\nconsole.log(user);\n\nconst users = User.fake(50);\nconsole.log(users);\n\n```\n\n## API\n\n### Static\n\n#### `Model.fake(size, locale): model|model[]`\nReturn fake model(s) instance base of specified `size` and `locale`\n\nExample:\n```js\nconst user = User.fake();\nconst users = User.fake(4);\n```\n\n#### `Model.fakeOnly(...fields): model|model[]`\nReturn a fake model(s) instance with only specified fields\n\nExample:\n```js\nconst user = User.fakeOnly('name', 'age');\nconst users = User.fakeOnly(4, 'name');\n```\n\n#### `Model.fakeExcept(...fields): model|model[]`\nReturn fake model(s) instance without specified fields\n\nExample:\n```js\nconst user = User.fakeExpect('name', 'age');\nconst users = User.fakeExpect(4, 'name', 'age');\n```\n\n### Instance\n\n#### `model.fakeOnly(...fields): model`\nReturn updated fake model instance with only specified fields updated\n\nExample:\n```js\n\n....\n\nconst user = user.fakeOnly('name');\nconst user = user.fakeOnly('name', 'age');\n```\n\n#### `model.fakeExcept(...fields): model`\nReturn updated fake model instance with specified fields not updated\n\nExample:\n```js\n\n...\n\nconst user = user.fakeExpect('name', 'age');\nconst users = user.fakeExpect('name', 'age');\n```\n\n\n\n## Testing\n* Clone this repository\n\n* Install all development dependencies\n```sh\n$ npm install\n```\n* Then run test\n```sh\n$ npm test\n```\n\n## Contribute\nIt will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.\n\n## Licence\nThe MIT License (MIT)\n\nCopyright (c) lykmapipo \u0026 Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fmongoose-faker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykmapipo%2Fmongoose-faker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykmapipo%2Fmongoose-faker/lists"}