{"id":20109780,"url":"https://github.com/hyper63/hyper-adapter-mongodb","last_synced_at":"2025-03-02T18:24:41.597Z","repository":{"id":45293982,"uuid":"388805496","full_name":"hyper63/hyper-adapter-mongodb","owner":"hyper63","description":"MongoDB Data Adapter for Hyper Data Port","archived":false,"fork":false,"pushed_at":"2024-08-19T20:39:27.000Z","size":397,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-13T05:41:35.099Z","etag":null,"topics":["clean-architecture","deno","document","hyper","mongodb","ports-and-adapters","service-framework"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyper63.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-23T13:09:55.000Z","updated_at":"2024-08-19T20:39:30.000Z","dependencies_parsed_at":"2023-10-11T00:44:22.078Z","dependency_job_id":"7e87154c-5ddb-4334-a73c-52640fb3c2e8","html_url":"https://github.com/hyper63/hyper-adapter-mongodb","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":"hyper63/adapter-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper63%2Fhyper-adapter-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper63%2Fhyper-adapter-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper63%2Fhyper-adapter-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyper63%2Fhyper-adapter-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyper63","download_url":"https://codeload.github.com/hyper63/hyper-adapter-mongodb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241550012,"owners_count":19980639,"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":["clean-architecture","deno","document","hyper","mongodb","ports-and-adapters","service-framework"],"created_at":"2024-11-13T18:09:24.993Z","updated_at":"2025-03-02T18:24:41.570Z","avatar_url":"https://github.com/hyper63.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003ehyper-adapter-mongodb\u003c/h1\u003e\n\u003cp\u003eA hyper data port adapter that uses mongodb in the \u003ca href=\"https://hyper.io\"\u003ehyper\u003c/a\u003e service framework\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://nest.land/package/hyper-adapter-mongodb\"\u003e\u003cimg src=\"https://nest.land/badge.svg\" alt=\"Nest Badge\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hyper63/hyper-adapter-mongodb/actions/workflows/test-and-publish.yml\"\u003e\u003cimg src=\"https://github.com/hyper63/hyper-adapter-mongodb/actions/workflows/test-and-publish.yml/badge.svg\" alt=\"Test\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hyper63/hyper-adapter-mongodb/tags/\"\u003e\u003cimg src=\"https://img.shields.io/github/tag/hyper63/hyper-adapter-mongodb\" alt=\"Current Version\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003c!-- toc --\u003e\n\n- [Background](#background)\n- [Getting Started](#getting-started)\n  - [MongoDB In-Memory](#mongodb-in-memory)\n- [Installation](#installation)\n- [Features](#features)\n- [Methods](#methods)\n- [Contributing](#contributing)\n- [Testing](#testing)\n  - [Integration Tests](#integration-tests)\n- [TODO](#todo)\n- [License](#license)\n\n\u003c!-- tocstop --\u003e\n\n## Background\n\nMongoDB is a NoSQL database that is very popular in the developer ecosystem. With this adapter, you\nwill be able to use MongoDB as your data store for your hyper applications.\n\nFor more information on MongoDB: https://www.mongodb.com/\n\n## Getting Started\n\ncreate `hyper.config.js`\n\n```js\nimport { default as mongo } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-mongodb/{TAG}/mod.ts'\n\nconst connectionString = Deno.env.get('MONGODB_URL')\n\nexport default {\n  app: express,\n  adapter: [\n    {\n      port: 'data',\n      plugins: [mongo({ url: connectionString })],\n    },\n  ],\n}\n```\n\ncreate `mod.js`\n\n```js\nimport core from 'https://raw.githubusercontent.com/hyper63/hyper/hyper%40v4.3.2/packages/core/mod.ts'\nimport config from './hyper.config.js'\n\ncore(config)\n```\n\n### MongoDB In-Memory\n\nThis adapter supports dynamically starting a local MongoDB server, running in memory. This is a\ngreat option for running a hyper Server locally, without needing to also spin up MongoDB locally\n(this what [hyper-nano](https://github.com/hyper63/hyper/tree/main/images/nano) is doing underneath\nthe hood).\n\nTo start a local MongoDB server, simply pass the `dir` option to the adapter. You can also specify\n`dirVersion` to specify the version of MongoDB to spin up locally.\n\n```js\nimport { default as mongo } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-mongodb/{TAG}/mod.ts'\n\nexport default {\n  app: express,\n  adapter: [\n    {\n      port: 'data',\n      plugins: [mongo({ dir: '__hyper__', dirVersion: '7.0.4' })],\n    },\n  ],\n}\n```\n\nThe adapter will dynamically download the corresponding MongoDB binary, start it, then generate a\nconnection string that the adapter will use to connect to it.\n\n\u003e The MongoDB binary is downloaded and cached in `dir`, if it does not already exist. This may take\n\u003e some time the first startup, but then is fast after caching. MongoDB data is stored in\n\u003e `{dir}/data`. The binary plus the internal MongoDB data can typically require a non-trivial amount\n\u003e of disk, around 500MB.\n\n## Installation\n\nThis is a Deno module available to import from Github via Git Tags\n\ndeps.js\n\n```\nexport { default as mongodb } from \"https://raw.githubusercontent.com/hyper63/hyper-adapter-mongodb/{TAG}/mod.ts\"\n```\n\n## Features\n\n- Create a `MongoDb` database\n- Remove a `MongoDb` database\n- Create a document\n- Retrieve a document\n- Update a document\n- Remove a document\n- List documents\n- Query documents\n- Index documents\n- Bulk manage documents\n\n## Methods\n\nThis adapter fully implements the Data port and can be used as the\n[hyper Data Service](https://docs.hyper.io/data-api) adapter\n\nSee the full port [here](https://github.com/hyper63/hyper/tree/main/packages/port-data)\n\n## Contributing\n\nContributions are welcome! See the hyper\n[contribution guide](https://docs.hyper.io/oss/contributing-to-hyper)\n\n## Testing\n\nRun the unit tests, lint, and check formatting run:\n\n```sh\ndeno task test\n```\n\n### Integration Tests\n\n\u003e If you're developing in [`Gitpod`](https://gitpod.io), a MongoDB instance is automatically started\n\u003e for you\n\nTo run the integration tests, you will need an instance of MongoDB running, along with setting\n`MONGO_URL` to your connection string. For convenience you may use the `Dockerfile` in `.mongodb`\ndirectory:\n\n```sh\ndocker build -t hyper-mongodb .mongodb\ndocker run -it -p 27017:27017 hyper-mongodb\n```\n\nYou can also use a MongoDB Atlas Instance, as long your `MONGO_URL` is set to the correct connection\nstring.\n\nTo run the tests on the adapter methods run:\n\n```sh\ndeno task test:integration-native\n```\n\n## TODO\n\n- Implement support for\n  [MongoDB Atlas Data API](https://www.mongodb.com/docs/atlas/app-services/data-api/). See\n  [this issue](https://github.com/hyper63/hyper-adapter-mongodb/issues/36)\n\n## License\n\nApache-2.0\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyper63%2Fhyper-adapter-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyper63%2Fhyper-adapter-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyper63%2Fhyper-adapter-mongodb/lists"}