{"id":20757252,"url":"https://github.com/vapor-community/mongo-provider","last_synced_at":"2026-03-05T03:31:31.665Z","repository":{"id":104073496,"uuid":"69083788","full_name":"vapor-community/mongo-provider","owner":"vapor-community","description":"MongoDB Provider for Vapor","archived":false,"fork":false,"pushed_at":"2018-02-08T19:38:09.000Z","size":22,"stargazers_count":40,"open_issues_count":6,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-20T16:43:45.672Z","etag":null,"topics":["cache","database","mongo","swift","vapor","vapor-provider"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vapor-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-09-24T06:05:11.000Z","updated_at":"2024-02-23T20:01:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8a8734e-70b1-4793-aad0-4404d182488e","html_url":"https://github.com/vapor-community/mongo-provider","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/vapor-community/mongo-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-community%2Fmongo-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-community%2Fmongo-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-community%2Fmongo-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-community%2Fmongo-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vapor-community","download_url":"https://codeload.github.com/vapor-community/mongo-provider/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vapor-community%2Fmongo-provider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30108607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T01:39:18.192Z","status":"online","status_checked_at":"2026-03-05T02:00:06.710Z","response_time":93,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cache","database","mongo","swift","vapor","vapor-provider"],"created_at":"2024-11-17T09:41:09.281Z","updated_at":"2026-03-05T03:31:31.644Z","avatar_url":"https://github.com/vapor-community.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg \n        src=\"https://thumbsplus.tutsplus.com/uploads/users/1116/posts/24835/preview_image/mongodb-logo.png?height=300\u0026width=300\" \n        align=\"center\" \n        alt=\"Mongo\"\n        width=\"300px\"\n    \u003e\n\u003c/p\u003e\n\n# Mongo Provider\n\n![Swift](http://img.shields.io/badge/swift-3.0-brightgreen.svg)\n[![CircleCI](https://circleci.com/gh/vapor/mongo-provider.svg?style=shield)](https://circleci.com/gh/vapor-community/mongo-provider)\n[![Slack Status](http://vapor.team/badge.svg)](http://vapor.team)\n\n## ⬇ Install the MongoDB server\n\n### OS X\n\nFor more instructions, check out https://docs.mongodb.com/master/administration/install-community/.\n\n```shell\nbrew install mongodb\n```\n\n### Linux\n\n```shell\nsudo apt-get update\nsudo apt-get install mongodb\n```\n\n### Run the server\n\n```shell\nmongod\n```\n\n## 📦 Add Provider\n\nNow to use Mongo in your Vapor project.\n\n### Package\n\nAdd the package to your `Package.swift`.\n\n```swift\n.Package(url: \"https://github.com/vapor/mongo-provider.git\", majorVersion: 2)\n```\n\n### Droplet\n\nAdd the provider to your Droplet.\n\n```swift\nimport Vapor\nimport MongoProvider\n\nlet drop = Droplet()\ntry drop.addProvider(MongoProvider.Provider.self)\n```\n\nAnd configure Fluent to use MongoDB by changing the key `\"driver\"` to be `\"mongo\"` inside `Config/fluent.json\n\n### Config\n\nThen add a `mongo.json` to your `Config` folder. You can add it in the root or keep it out of git in the secrets folder.\n\n```\nConfig/\n  - mongo.json\n    secrets/\n      - mongo.json\n```\n\nThe secrets folder is under the `.gitignore` and shouldn't be committed.\n\nHere's an example `secrets/mongo.json`\n\n```json\n{\n  \"url\": \"mongodb://\u003cdb-user\u003e:\u003cdb-password\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdatabase\u003e\"\n}\n```\n\n\u003e Note: `port` and `host` are optional.\n\n### Manual\n\nYou can also manually configure the provider in code. This will bypass the configuration files.\n\n```swift\nimport Vapor\nimport MongoProvider\n\nlet drop = Droplet()\n\nlet mongo = try MongoProvider.Provider(database: ..., user: ..., password: ...)\ndrop.addProvider(mongo)\n```\n\n## 📖 Documentation\n\nVisit the Vapor web framework's [documentation](http://docs.vapor.codes) for more instructions on how to use this package.\n\n## 💧 Community\n\nJoin the welcoming community of fellow Vapor developers in [slack](http://vapor.team).\n\n## 🔧 Compatibility\n\nThis package has been tested on macOS and Ubuntu.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvapor-community%2Fmongo-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvapor-community%2Fmongo-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvapor-community%2Fmongo-provider/lists"}