{"id":15572945,"url":"https://github.com/jedireza/hapi-mongo-models","last_synced_at":"2025-06-22T19:08:14.454Z","repository":{"id":24574503,"uuid":"27982096","full_name":"jedireza/hapi-mongo-models","owner":"jedireza","description":":package: A hapi plugin for `mongo-models`","archived":false,"fork":false,"pushed_at":"2022-12-03T12:11:19.000Z","size":332,"stargazers_count":101,"open_issues_count":6,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-22T19:07:44.588Z","etag":null,"topics":["hapi","hapi-plugin","javascript","mongodb","nodejs"],"latest_commit_sha":null,"homepage":"","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/jedireza.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":"2014-12-14T03:31:19.000Z","updated_at":"2025-06-13T23:07:12.000Z","dependencies_parsed_at":"2023-01-14T01:13:35.290Z","dependency_job_id":null,"html_url":"https://github.com/jedireza/hapi-mongo-models","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/jedireza/hapi-mongo-models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedireza%2Fhapi-mongo-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedireza%2Fhapi-mongo-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedireza%2Fhapi-mongo-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedireza%2Fhapi-mongo-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jedireza","download_url":"https://codeload.github.com/jedireza/hapi-mongo-models/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedireza%2Fhapi-mongo-models/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261348751,"owners_count":23145313,"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":["hapi","hapi-plugin","javascript","mongodb","nodejs"],"created_at":"2024-10-02T18:08:57.204Z","updated_at":"2025-06-22T19:08:09.439Z","avatar_url":"https://github.com/jedireza.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-mongo-models\n\nA hapi plugin for [`mongo-models`](https://github.com/jedireza/mongo-models).\n\n[![Build Status](https://travis-ci.org/jedireza/hapi-mongo-models.svg?branch=master)](https://travis-ci.org/jedireza/hapi-mongo-models)\n[![Dependency Status](https://david-dm.org/jedireza/hapi-mongo-models.svg?style=flat)](https://david-dm.org/jedireza/hapi-mongo-models)\n[![devDependency Status](https://david-dm.org/jedireza/hapi-mongo-models/dev-status.svg?style=flat)](https://david-dm.org/jedireza/hapi-mongo-models#info=devDependencies)\n[![peerDependency Status](https://david-dm.org/jedireza/hapi-mongo-models/peer-status.svg?style=flat)](https://david-dm.org/jedireza/hapi-mongo-models#info=peerDependencies)\n\n\n## Install\n\n```bash\n$ npm install hapi-mongo-models\n```\n\n\n### Server plugin\n\nDuring plugin registration we connect to MongoDB using the supplied options.\n\nDuring Hapi's `onPreStart` server extension point and based on your `autoIndex`\noption, we create any indexes defined in the `models` supplied.\n\n#### Register\n\n```js\nconst HapiMongoModels = require('hapi-mongo-models');\n\nconst plugin = {\n    plugin: HapiMongoModels,\n    options: {\n        mongodb: {\n            connection: {\n                uri: 'mongodb://localhost:27017/',\n                db: 'hapi-mongo-models-test'\n            },\n            options: {}\n        },\n        models: [\n            './path/to/customer',\n            './path/to/order'\n        ],\n        autoIndex: false\n    }\n};\n\nawait server.register(plugin);\n```\n\n### Plugin options\n\nThe options passed to the plugin is an object where:\n\n- `mongodb` - is an object where:\n  - `connection` - is an object where:\n    - `uri` - a string representing the connection uri for MongoDB.\n    - `db` - the name of the database.\n  - `options` - an optional object passed to MongoDB's native connect function.\n- `autoIndex` - a boolean specifying if the plugin should call `createIndexes`\n   for each model that has a static `indexes` property. Defaults to `true`.\n   Typically set to `false` in production environments.\n- `models` - an array strings representing the paths to the models (relative to\n  the current working directory or absolute) of where to find the model on\n  disk.\n\n\n## Have a question?\n\nAny issues or questions (no matter how basic), open an issue. Please take the\ninitiative to read relevant documentation and be pro-active with debugging.\n\n\n## Want to contribute?\n\nContributions are welcome. If you're changing something non-trivial, you may\nwant to submit an issue before creating a large pull request.\n\nNote: This plugin is designed for basic use-cases. If you find yourself\nneeding more, consider using the source as inspiration and create a custom\nplugin for your app.\n\n\n## License\n\nMIT\n\n\n## Don't forget\n\nWhat you create with `hapi-mongo-models` is more important than `hapi-mongo-models`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedireza%2Fhapi-mongo-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjedireza%2Fhapi-mongo-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedireza%2Fhapi-mongo-models/lists"}