{"id":20145030,"url":"https://github.com/michalswi/cosmosdb-mongodb","last_synced_at":"2026-05-09T05:01:59.963Z","repository":{"id":112988950,"uuid":"486933130","full_name":"michalswi/cosmosdb-mongodb","owner":"michalswi","description":"Azure Cosmos DB API for MongoDB","archived":false,"fork":false,"pushed_at":"2022-04-29T11:43:41.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T00:12:08.206Z","etag":null,"topics":["azure","cosmosdb","golang","mongodb","nosql"],"latest_commit_sha":null,"homepage":"","language":"HCL","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/michalswi.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":"2022-04-29T10:37:49.000Z","updated_at":"2022-07-23T17:25:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"8517d491-37a2-468a-a17a-956d4467b82e","html_url":"https://github.com/michalswi/cosmosdb-mongodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michalswi/cosmosdb-mongodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalswi%2Fcosmosdb-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalswi%2Fcosmosdb-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalswi%2Fcosmosdb-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalswi%2Fcosmosdb-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michalswi","download_url":"https://codeload.github.com/michalswi/cosmosdb-mongodb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalswi%2Fcosmosdb-mongodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32807861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["azure","cosmosdb","golang","mongodb","nosql"],"created_at":"2024-11-13T22:13:40.163Z","updated_at":"2026-05-09T05:01:59.943Z","avatar_url":"https://github.com/michalswi.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Azure Cosmos DB API for MongoDB\n\nAzure docs [here](https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb/mongodb-introduction) .  \nTerraform related docs [here](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cosmosdb_account) .  \n\nDeployed CosmosDB for MongoDB base on [pricing]() including:\n- free tier\n- serverless\n- periodic backup policy \n- Local Redundant Storage (LRS)\n\n### \\# **terraform**\n\nBy default network access from the VNet defined in tf file and from Your public IP.  \nTo fetch your IP you can deploy your own service check [here](https://michalswi.medium.com/simple-app-to-fetch-ip-address-be8907eca1c6) .\n```\naz login\n\nNAME=demo \\\nLOCATION=westeurope \\\nPUB_IP=\u003c\u003e\n\nterraform init\nterraform plan -var name=$NAME -var location=$LOCATION -var public_ip=$PUB_IP -out=out.plan\nterraform apply out.plan\n```\n\n### \\# **connection**\n\nConnection string you can find here:  \n`Azure portal / \u003cAzure Cosmos DB API for MongoDB\u003e / Connection string`\n\n#### \\\u003e **mongosh**\n```\n$ mongosh \"\u003cconnection-string\u003e\"\n(...)\nglobaldb [primary] test\u003e db\ntest\nglobaldb [primary] test\u003e use demodb\nswitched to db demodb\nglobaldb [primary] demodb\u003e db\ndemodb\nglobaldb [primary] demodb\u003e db.movie.insert({\"name\":\"movie1\"})\nglobaldb [primary] demodb\u003e db.movie.insert({\"_id\":1,\"name\":\"movie0\"})\nglobaldb [primary] demodb\u003e db.movie.find().pretty()\n[\n  { _id: ObjectId(\"626b9c74948e76f690236f2d\"), name: 'movie1' },\n  { _id: 1, name: 'movie0' }\n]\n```\n\n#### \\\u003e **go-client**\n```\n$ export MONGODB_CONNECTION_STRING=\"\u003cconnection-string\u003e\"\n$ go build\n$ ./cosmosdb-mongodb list\nmongodb-client 2022/04/28 20:31:03 client.go:45: Connecting...\nmongodb-client 2022/04/28 20:31:05 client.go:58: Successfully created connection to database.\nList databases:\n[demodb]\n```\n\n#### \\\u003e **Data Explorer**\n\nTo enable **Data Explorer** functionality you have to enable access first:  \n`Azure portal / \u003cAzure Cosmos DB API for MongoDB\u003e / Firewall and virtual networks / tick - Allow access from Azure Portal`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalswi%2Fcosmosdb-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichalswi%2Fcosmosdb-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalswi%2Fcosmosdb-mongodb/lists"}