{"id":14956888,"url":"https://github.com/kevindasilvas/mongolia","last_synced_at":"2026-02-10T16:31:42.160Z","repository":{"id":42642941,"uuid":"360341687","full_name":"KevinDaSilvaS/mongolia","owner":"KevinDaSilvaS","description":"Data gateway / rest interface for mongo db inspired by datastax Stargate","archived":false,"fork":false,"pushed_at":"2022-03-29T22:55:09.000Z","size":542,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-13T14:39:04.853Z","etag":null,"topics":["data-gateway","docker-image","insomnia","mongo-db","mongodb","mongolia","mongoose","node","node-js","nodejs","rest","rest-interface"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/kevindasilvas/mongolia","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/KevinDaSilvaS.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":"2021-04-22T00:09:17.000Z","updated_at":"2022-03-29T22:54:58.000Z","dependencies_parsed_at":"2022-09-08T15:30:37.969Z","dependency_job_id":null,"html_url":"https://github.com/KevinDaSilvaS/mongolia","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinDaSilvaS%2Fmongolia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinDaSilvaS%2Fmongolia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinDaSilvaS%2Fmongolia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinDaSilvaS%2Fmongolia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinDaSilvaS","download_url":"https://codeload.github.com/KevinDaSilvaS/mongolia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648925,"owners_count":20972942,"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":["data-gateway","docker-image","insomnia","mongo-db","mongodb","mongolia","mongoose","node","node-js","nodejs","rest","rest-interface"],"created_at":"2024-09-24T13:13:40.846Z","updated_at":"2026-02-10T16:31:42.114Z","avatar_url":"https://github.com/KevinDaSilvaS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity) \n[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n![Coverage](https://img.shields.io/badge/coverage-91%25-brightgreen)\n \n - [Welcome](https://github.com/KevinDaSilvaS/mongolia#welcome-to-mongolia)\n - [Docs](https://github.com/KevinDaSilvaS/mongolia/blob/main/README.md#docs)\n - \t- [Get started](https://github.com/KevinDaSilvaS/mongolia#getting-started)\n - \t- [Run mongodb](https://github.com/KevinDaSilvaS/mongolia#-run-mongo-db-instance)\n - \t- [Run mongolia](https://github.com/KevinDaSilvaS/mongolia#-run-mongolia-container)\n - \t- [Authenticating](https://github.com/KevinDaSilvaS/mongolia#-authenticating-to-mongolia)\n - \t- [Creating collections](https://github.com/KevinDaSilvaS/mongolia#-creating-a-collection)\n - \t- [Insert in collections](https://github.com/KevinDaSilvaS/mongolia#-inserting-in-collection)\n - \t- [Get registers](https://github.com/KevinDaSilvaS/mongolia#-get-info-in-collection)\n - \t- [Update registes](https://github.com/KevinDaSilvaS/mongolia#-update-info-in-collection)\n - \t- [Delete registers](https://github.com/KevinDaSilvaS/mongolia#-delete-info-in-collection)\n - [More examples and resources](https://github.com/KevinDaSilvaS/mongolia#more-examples)\n - [Supported types](https://github.com/KevinDaSilvaS/mongolia#currently-supported-types)\n - [Collection properties](https://github.com/KevinDaSilvaS/mongolia#collection-properties)\n - [Pagination](https://github.com/KevinDaSilvaS/mongolia#pagination)\n - [Comparative Queries](https://github.com/KevinDaSilvaS/mongolia#comparitive-queries)\n - [Contribute](https://github.com/KevinDaSilvaS/mongolia#contribute)\n - [Use cases examples](https://github.com/KevinDaSilvaS/mongolia#use-cases)\n# Welcome to Mongolia!\n**Mongolia** is a rest interface / data gateway built in node js and inspired by tools like stargate(cassandra) and prest(postgres).\n  **Application types where Mongolia can be really useful:**\n - Dockerized apps (mongolia has a docker image that can be easily composable).\n - Small apps or simple projects that dont need a backend with business rules only bson storage.\n - Programming languages that dont have a good mongo db driver. Or languages where the drivers are not well documented.\n - Fast prototiping without having to worry about database configuration and pocs.\n\n# DOCS\n\nMongolia readme **docs!**\n\n## Getting Started\n\n### \u003e Run mongo db instance:\nUsing a default mongo db container  ``docker run -e MONGO_INITDB_ROOT_USERNAME=mongolia -e MONGO_INITDB_ROOT_PASSWORD=123 MONGO_INITDB_DATABASE=admin -p 27017:27017`` or by using a ``docker-compose up -d`` if you want to use the docker compose in the official project folder: [docker-compose mongo db](https://github.com/KevinDaSilvaS/mongolia/blob/main/docker-compose.yml)\n\n### \u003e Run mongolia container:\nRun mongolia image: ``docker run -e MONGO_USERNAME=mongolia \n    -e MONGO_PASSWORD=123 \n    -e MONGODB_NAME=admin \n    -e MONGODB_HOST=localhost \n    -e MONGODB_PORT=27017 \n    -p 3170:3170 kevindasilvas/mongolia`` \n    or if you used the docker compose from the official project:\n    ``docker run -e MONGO_USERNAME=mongolia\n    -e MONGO_PASSWORD=123 \n    -e MONGODB_NAME=admin \n    -e MONGODB_HOST=mongolia_mongo_1 \n    -e MONGODB_PORT=27017 \n    -p 3170:3170 --net mongolia_default kevindasilvas/mongolia\n    ``\n### \u003e Authenticating to Mongolia (POST):\nUsing a request manager like insomnia([we have a collection ready for insomnia](https://github.com/KevinDaSilvaS/mongolia/blob/main/collections/insomnia/mongolia_2021-04-23.json)), postman, curl or your own app if you want to, make a post request to``localhost:3170/auth `` , with a body containing the mongo username and password ``{\n\t\"username\": \"mongolia\",\n\t\"password\": \"123\"\n}`` if successful mongolia will return a payload containing the http code and the auth token like this: ``{\n  \"code\": 201,\n  \"details\": {\n    \"mongolia_auth_token\": \"b61fddb0-622a-4b56-8144-4b116aa480cf\"\n  }\n}\n``\n\n### \u003e Creating a collection (POST):\nNow that we have the mongolia_auth_token in hands, we will set it as a header in our request ``\"mongolia_auth_token\": \"b61fddb0-622a-4b56-8144-4b116aa480cf\"\n`` , we´ll set a body containing the collection name and the collection properties: ``{\n \"collectionName\": \"users\",\n\t\"collectionProperties\": {\n\t\t\"name\": {\n\t\t\t\"type\": \"String\",\n\t\t\t\"required\":true\n\t\t},\n\t\t\"age\": {\n\t\t\t\"type\": \"Number\"\n\t\t}\n\t}\n}\n``(more on [collection properties](https://github.com/KevinDaSilvaS/mongolia#collection-properties) and [allowed types](https://github.com/KevinDaSilvaS/mongolia#currently-supported-types)) and with our header and body set lets make a post request to``localhost:3170/collections``,if successful mongolia will return an 204 http code response.\n\n### \u003e Inserting in collection (POST):\nSet the``\"mongolia_auth_token\": \"b61fddb0-622a-4b56-8144-4b116aa480cf\" \n``in headers again , and lets add a body to the request``{\n\t\t\"name\": \"kevin\",\n\t\t\"age\": 21\n}\n`` and execute a post request to``localhost:3170/collections/users``,if successful mongolia will return an 201 http code response with the repective body: ``{\n  \"code\": 201,\n  \"details\": {\n    \"_id\": \"60843c79632f1dc33f3dbeaa\",\n    \"name\": \"kevin\",\n    \"age\": 21,\n    \"__v\": 0\n  }\n}``.\n\n### \u003e Get info in collection (GET):\nSet the``\"mongolia_auth_token\": \"b61fddb0-622a-4b56-8144-4b116aa480cf\" \n``in headers again , and lets set our GET url `` localhost:3170/collections/users?name=kevin``.You can add every collection field you set in collection properties + the default _id field in mongo to make your queries into mongo db (example:`` localhost:3170/collections/users?name=kevin\u0026age=21\u0026_id=random_mongo_id``), but lets run our query, if everything get well you will get a result like this: ``{\n  \"code\": 200,\n  \"details\": [{\n  \"_id\": \"60843c79632f1dc33f3dbeaa\",\n    \"name\": \"kevin\",\n    \"age\": 21,\n    \"__v\": 0\n  }]\n}``\n\n### \u003e Update info in collection (PATCH):\nSet the``\"mongolia_auth_token\": \"b61fddb0-622a-4b56-8144-4b116aa480cf\" \n``in headers, set the body using the collection fields that you set in collectionProperties that you want to update  ``{\n\t\t\"name\": \"kevin updated this record\"\n}\n`` and lets set our Path url `` localhost:3170/collections/users?name=kevin``. if everything went well you will get a response like this: ``{\n  \"code\": 200,\n  \"details\": {\n    \"n\": 1,\n    \"nModified\": 1,\n    \"ok\": 1\n  }\n}``\n\n### \u003e Delete info in collection (DELETE):\nThe steps are basically the same in the get you set ``\"mongolia_auth_token\": \"b61fddb0-622a-4b56-8144-4b116aa480cf\" \n``in headers and lets set our Path url `` localhost:3170/collections/users?name=kevin``. if everything went well you will get a response like this: ``{\n  \"code\": 200,\n  \"details\": {\n    \"n\": 1,\n    \"ok\": 1,\n    \"deletedCount\": 1\n  }\n}``\n\n## More Examples\n- [Get started (medium article)](https://kevin-da-silva.medium.com/lets-talk-about-mongolia-mongo-db-as-a-rest-api-d5d5f8a3f885)\n\n## Currently Supported Types\n\nMongolia currently supports the following mongo types: [``\"String\"``, ``\"Number\"``,\n\n``\"Date\"``, ``\"Buffer\"``, ``\"Boolean\"``,\n\n``\"Mixed\"``, ``\"ObjectId\"``, ``\"Array\"``,\n\n``\"Decimal128\"``, ``\"Map\"``, ``\"Schema\"``]. And array combinations with all the above types:  [``\"[String]\"``, ``\"[Number]\"``,\n\n``\"[Date]\"``, ``\"[Buffer]\"``, ``\"[Boolean]\"``,\n\n``\"[Mixed]\"``, ``\"[ObjectId]\"``, ``\"[Array]\"``,\n\n``\"[Decimal128]\"``, ``\"[Map]\"``, ``\"[Schema]\"``]\n\n## Collection properties:\n\nMongolia currently supports the ``type``([supported types](https://github.com/KevinDaSilvaS/mongolia#currently-supported-types) for this field), ``required``(true, false) and the ``unique``(true, false) properties\n\n## Pagination:\n\nMongolia in get registers in collection not only supports fields but also supports the ```?page=1``` and the ```\u0026limit=10```,that you can customize to the amount of registers and pages do you need. Get example: `` localhost:3170/collections/users?name=kevin\u0026page=2\u0026limit=30``\n\n## Comparitive Queries:\n\nSince Mongolia 1.2 we allow the users to make queries using the following mongo comparative attributes( ```GT - greater than, GTE - greater than equal, LT - less than, LTE - less than equal, EQ - equal```). Get example: `` localhost:3170/collections/users?name=kevin\u0026age=@\u003eGT18`` mongolia also allow combinations of comparative attributes, like: `` localhost:3170/collections/users?name=kevin\u0026age=@\u003eGT18@\u003eLT35``\n\n# Contribute\n\nThe mongolia project is always open for contributions, issues and Q\u0026As.\n**The project will be more focused in the following topics:**\n\u003e Adding more collection properties like default value for example\nBut these are just suggestions we always try to be very community oriented so feel free to contribute with your PR.\n\n# Use cases\n\nUse cases where mongolia showed its value connecting applications and mongo db through rest.\n\n\u003e **ProTip:** More in the future.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevindasilvas%2Fmongolia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevindasilvas%2Fmongolia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevindasilvas%2Fmongolia/lists"}