{"id":20331876,"url":"https://github.com/grafbase/mongodb-data-api","last_synced_at":"2025-05-08T01:31:15.432Z","repository":{"id":187519943,"uuid":"677057461","full_name":"grafbase/mongodb-data-api","owner":"grafbase","description":null,"archived":true,"fork":false,"pushed_at":"2024-11-11T22:52:30.000Z","size":96,"stargazers_count":7,"open_issues_count":11,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-28T03:43:28.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/grafbase.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":"2023-08-10T16:26:56.000Z","updated_at":"2024-11-12T16:00:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7a07c80-93f7-425c-8406-fdf7cbadb68d","html_url":"https://github.com/grafbase/mongodb-data-api","commit_stats":null,"previous_names":["grafbase/mongodb-data-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Fmongodb-data-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Fmongodb-data-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Fmongodb-data-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafbase%2Fmongodb-data-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafbase","download_url":"https://codeload.github.com/grafbase/mongodb-data-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251408522,"owners_count":21584769,"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":[],"created_at":"2024-11-14T20:23:57.603Z","updated_at":"2025-05-08T01:31:15.172Z","avatar_url":"https://github.com/grafbase.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoDB Atlas Data API\n\nA small server serving MongoDB Atlas Data API for test usage.\nConnects to MongoDB using TCP and provides an HTTP API, which\nmight be useful if TCP is not available.\n\nPlease do not use in production, skips everything else except\nthings we might need in the CI. Super unsafe, probably destroys\neverything.\n\n## Usage\n\n```console\nUsage: mongodb-data-api [OPTIONS] --mongodb-url \u003cMONGODB_URL\u003e\n\nOptions:\n      --hostname \u003cHOSTNAME\u003e        [default: 127.0.0.1]\n      --port \u003cPORT\u003e                [default: 3000]\n      --mongodb-url \u003cMONGODB_URL\u003e  \n  -h, --help                       Print help\n  -V, --version                    Print version\n```\n\nTo connect to a MongoDB instance, pass the URL as a parameter to\nthe API:\n\n```console\n\u003e mongodb-data-api --mongodb-url \"mongodb://grafbase:grafbase@localhost:27018\"\n```\n\nThis connects to the MongoDB defined in the provided docker-compose\nfile. When the service is running (the default address is http:/127.0.0.1:3000),\nyou can start sending requests to it.\n\n## Docker\n\nThe repository contains an example docker-compose file for using the API together with a local\nMongoDB. The image can be found from [Docker Hub](https://hub.docker.com/repository/docker/grafbase/mongodb-data-api/).\n\n### Find One\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/findOne)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/findOne' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"projection\": { \"_id\": 1, \"foo\": 1 },\n      \"filter\": { \"_id\": { \"$oid\": \"64d50a0b967f134bfb3fb620\" } }\n  }'\n```\n\n### Find\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/find)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/find' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"projection\": { \"_id\": 1, \"foo\": 1 },\n      \"filter\": { \"foo\": { \"$eq\": \"lol\" } }\n  }'\n```\n\n### Insert One\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/insertOne)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/insertOne' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"document\": { \"foo\": \"lol\" }\n  }'\n```\n\n### Insert Many\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/insertMany)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/insertMany' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"documents\": [{ \"foo\": \"bar\" }, { \"foo\": \"lolbar\" }]\n  }'\n```\n\n### Update One\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/updateOne)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/updateOne' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"filter\": { \"_id\": { \"$eq\": { \"$oid\": \"64d5dda2154ceb5e6cfdf94e\" } } },\n      \"update\": { \"$set\": { \"foo\": \"musti\" } }\n  }'\n```\n\n### Update Many\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/updateMany)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/updateMany' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"filter\": { \"foo\": { \"$eq\": \"lol\" } },\n      \"update\": { \"$set\": { \"foo\": \"rofl\" } }\n  }'\n```\n\n### Delete One\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/deleteOne)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/deleteOne' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"filter\": { \"_id\": { \"$oid\": \"64d50a0b967f134bfb3fb620\" } }\n  }'\n```\n\n### Delete Many\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/deleteMany)\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/deleteMany' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\",\n      \"collection\": \"test\",\n      \"filter\": { \"foo\": { \"$eq\": \"rofl\" } }\n  }'\n```\n\n### Aggregate\n\n[Official documentation](https://www.mongodb.com/docs/atlas/app-services/data-api/openapi/#operation/aggregate)\n\nWe don't really need this (yet). It's implemented in this service, but not tested.\n\n### Drop Database\n\nThis is an unofficial command, but useful for cleaning up after a test is run. Drops the database defined in the request.\n\n```console\n\u003e curl --request POST \\\n  'http://127.0.0.1:3000/app/data-test/endpoint/data/v1/action/dropDatabase' \\\n  --header 'apiKey: TEST' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json' \\\n  --data-raw '{\n      \"dataSource\": \"grafbase\",\n      \"database\": \"test\"\n  }'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafbase%2Fmongodb-data-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafbase%2Fmongodb-data-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafbase%2Fmongodb-data-api/lists"}