{"id":13563161,"url":"https://github.com/emicklei/mora","last_synced_at":"2025-10-27T23:34:10.413Z","repository":{"id":57497064,"uuid":"11364928","full_name":"emicklei/mora","owner":"emicklei","description":"MongoDB generic REST server in Go","archived":false,"fork":false,"pushed_at":"2024-04-23T10:20:32.000Z","size":1690,"stargazers_count":316,"open_issues_count":9,"forks_count":55,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-29T18:07:28.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/emicklei.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":"2013-07-12T09:07:01.000Z","updated_at":"2025-03-23T21:50:34.000Z","dependencies_parsed_at":"2024-06-20T05:43:02.435Z","dependency_job_id":"fbcc7a12-f23c-411f-b503-141a124ad6bf","html_url":"https://github.com/emicklei/mora","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fmora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fmora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fmora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fmora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emicklei","download_url":"https://codeload.github.com/emicklei/mora/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"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-08-01T13:01:15.773Z","updated_at":"2025-10-27T23:34:05.388Z","avatar_url":"https://github.com/emicklei.png","language":"Go","readme":"# ![](static/Letter-M-icon.png) Mora - Mongo Rest API\n\n#### REST server for accessing MongoDB documents and meta data\n\t\n##### Documents\n\nWhen querying on collections those parameters are available:\n\n\tquery  - use mongo shell syntax, e.g. {\"size\":42}\n\tlimit  - maximum number of documents in the result\n\tskip   - offset in the result set\n\tfields - comma separated list of (path-dotted) field names\n\tsort   - comma separated list of (path-dotted) field names\n\textended_json - set to \"true\" to return responses in [MongoDB Extended JSON](http://docs.mongodb.org/manual/reference/mongodb-extended-json/) format\n\n##### Examples\n\n###### Listing aliases\n\n\n\t$ curl 'http://127.0.0.1:8181/docs/' \\\n\t\u003e   -D - \\\n\t\u003e   -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:06:30 GMT\n\tContent-Length: 61\n\n\t{\n\t  \"success\": true,\n\t  \"data\": [\n\t   \"test\",\n\t   \"local\"\n\t  ]\n\t}\n\n###### Listing databases\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/' \\\n\t\u003e   -D - \\\n\t\u003e   -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:07:11 GMT\n\tContent-Length: 61\n\n\t{\n\t  \"success\": true,\n\t  \"data\": [\n\t   \"local\",\n\t   \"use1\"\n\t  ]\n\t}\n\n###### Listing collections\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local' \\\n\t\u003e   -D - \\\n\t\u003e   -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:24:10 GMT\n\tContent-Length: 98\n\n\t{\n\t  \"success\": true,\n\t  \"data\": [\n\t   \"new-collection\",\n\t   \"startup_log\",\n\t   \"system.indexes\"\n\t  ]\n\t}\n\n###### Inserting document\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local/new-collection/document-id' \\\n\t-D - \\\n\t-X POST \\\n\t-H 'Content-Type: application/json' \\\n\t-H 'Accept: application/json' \\\n\t--data '{\"title\": \"Some title\", \"content\": \"document content\"}'\n\t\n\tHTTP/1.1 201 Created\n\tContent-Location: /docs/local/local/new-collection/document-id\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:23:33 GMT\n\tContent-Length: 116\n\n\t{\n\t  \"success\": true,\n\t  \"data\": {\n\t   \"created\": true,\n\t   \"url\": \"/docs/local/local/new-collection/document-id\"\n\t  }\n\t}\n\n###### Finding document\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local/new-collection/document-id' \\\n\t\u003e   -D - \\\n\t\u003e   -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:32:33 GMT\n\tContent-Length: 123\n\n\t{\n\t  \"success\": true,\n\t  \"data\": {\n\t   \"_id\": \"document-id\",\n\t   \"content\": \"document content\",\n\t   \"title\": \"Some title\"\n\t  }\n\t}\n\n###### Finding documents\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local/new-collection?limit=1\u0026skip=1' \\\n\t\u003e    -D - \\\n\t\u003e    -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Wed, 23 Apr 2014 23:18:39 GMT\n\tContent-Length: 387\n\n\t{\n\t  \"success\": true,\n\t  \"prev_url\": \"/docs/local/local/new-collection?limit=1\\u0026skip=0\",\n\t  \"next_url\": \"/docs/local/local/new-collection?limit=1\\u0026skip=2\",\n\t  \"data\": [\n\t   {\n\t    \"_id\": \"535849cfb734f91cdc000002\",\n\t    \"content\": \"document content\",\n\t    \"title\": \"Some title\"\n\t   }\n\t  ]\n\t}\n\n###### Updating document\n\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/database/new-collection/document-id' \\\n\t\u003e  -D - \\\n\t\u003e  -X PUT \\\n\t\u003e  -H 'Content-Type: application/json' \\\n\t\u003e  -H 'Accept: application/json' \\\n\t\u003e  --data '{\"title\": \"New title\"}'\n\tHTTP/1.1 200 OK\n\tContent-Location: /docs/local/database/new-collection/document-id\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 06:37:02 GMT\n\tContent-Length: 133\n\n\t{\n\t  \"success\": true,\n\t  \"data\": {\n\t   \"created\": false,\n\t   \"url\": \"/docs/local/database/new-collection/document-id\"\n\t  }\n\t}\n\n###### Updating documents\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local/new-collection' \\\n\t\u003e   -D - \\\n\t\u003e   -X PUT \\\n\t\u003e   -H 'Content-Type: application/json' \\\n\t\u003e   -H 'Accept: application/json' \\\n\t\u003e   --data '{\"$set\": {\"title\": \"New title\"}}'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Wed, 23 Apr 2014 23:33:11 GMT\n\tContent-Length: 22\n\n\t{\n\t  \"success\": true\n\t}\n\n###### Removing document\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local/new-collection/document-id'  \\\n\t\u003e   -D - \\\n\t\u003e   -X DELETE \\\n\t\u003e   -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:42:47 GMT\n\tContent-Length: 22\n\n\t{\n\t  \"success\": true\n\t}\n\n###### Removing collection\n\n\t$ curl 'http://127.0.0.1:8181/docs/local/local/new-collection'  \\\n\t\u003e   -D - \\\n\t\u003e   -X DELETE \\\n\t\u003e   -H 'Accept: application/json'\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 07:43:24 GMT\n\tContent-Length: 22\n\n\t{\n\t  \"success\": true\n\t}\n\n##### Statistics\n\n###### Database statistics\n\n\t$ curl http://127.0.0.1:8181/stats/local/local -D -\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 08:17:46 GMT\n\tContent-Length: 341\n\n\t{\n\t  \"success\": true,\n\t  \"data\": {\n\t   \"avgObjSize\": 595.6,\n\t   \"collections\": 3,\n\t   \"dataFileVersion\": {\n\t    \"major\": 4,\n\t    \"minor\": 5\n\t   },\n\t   \"dataSize\": 5956,\n\t   \"db\": \"local\",\n\t   \"fileSize\": 67108864,\n\t   \"indexSize\": 0,\n\t   \"indexes\": 0,\n\t   \"nsSizeMB\": 16,\n\t   \"numExtents\": 3,\n\t   \"objects\": 10,\n\t   \"ok\": 1,\n\t   \"storageSize\": 10502144\n\t  }\n\t}\n\n###### Collection statistics\n\n\t$ curl http://127.0.0.1:8181/stats/local/local/startup_log -D -\n\tHTTP/1.1 200 OK\n\tContent-Type: application/json\n\tDate: Tue, 22 Apr 2014 08:18:16 GMT\n\tContent-Length: 389\n\n\t{\n\t  \"success\": true,\n\t  \"data\": {\n\t   \"avgObjSize\": 728,\n\t   \"capped\": true,\n\t   \"count\": 8,\n\t   \"indexSizes\": {},\n\t   \"lastExtentSize\": 10485760,\n\t   \"max\": 9223372036854775807,\n\t   \"nindexes\": 0,\n\t   \"ns\": \"local.startup_log\",\n\t   \"numExtents\": 1,\n\t   \"ok\": 1,\n\t   \"paddingFactor\": 1,\n\t   \"size\": 5824,\n\t   \"storageSize\": 10485760,\n\t   \"systemFlags\": 0,\n\t   \"totalIndexSize\": 0,\n\t   \"userFlags\": 0\n\t  }\n\t}\n\n### Install from source\n\t\t\t\t\t\t\n\tgo get -u github.com/emicklei/mora\n\t\n### Create a release\n\t\n\tsh release.sh\n\n### Configuration\n\nMora uses a simple properties file to specify host,port,aliases and other options\n\n\t# listener info is required\n\thttp.server.host=localhost\n\thttp.server.port=8181\n\t\n\t# enable cross site requests\n\thttp.server.cors=true\n\n\t# for swagger support (optional)\n\tswagger.path=/apidocs/\n\tswagger.file.path=./swagger-ui/dist\n\n\t# mongo instances are listed here; specify an alias for each\n\tmongod.{alias}.host=localhost\n\tmongod.{alias}.port=27017\n\t# initial and operational timeout in seconds\n\tmongod.{alias}.timeout=5\n\t# optional authentication\n\tmongod.{alias}.username=\n\tmongod.{alias}.password=\n\tmongod.{alias}.database=\n\t# read preference mode\n\t# supported options (case-insensitive): https://godoc.org/gopkg.in/mgo.v2#Mode\n\tmongod.{alias}.mode=primary\n\t# alternatively, a mongodb connection string uri can be used instead\n\t# supported options: https://godoc.org/gopkg.in/mgo.v2#Dial\n\tmongod.{alias}.uri=mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb\n\n\t# enable /stats/ endpoint\n\tmora.statistics.enable=true\n\n\n### Run\n\n\t$ mora -config mora.properties\n\n### Swagger\n\nSwagger UI is displaying automatically generated API documentation and playground.\n\n![Swagger UI](https://s3.amazonaws.com/public.philemonworks.com/mora/mora-2013-08-04.png)\n\n\t\n\u0026copy; 2013, http://ernestmicklei.com. MIT License\n - Icons from http://www.iconarchive.com, CC Attribution 3.0\n - Swagger from https://github.com/wordnik/swagger-core/wiki, Apache License, Version 2.0\n","funding_links":[],"categories":["Software Packages","软件包","Go","DevOps Tools","軟件包","Go Tools","Utilities","Go 工具"],"sub_categories":["DevOps Tools","DevOps工具","devops 工具","DevOps 工具","Middlewares","Contents","代码分析"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fmora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femicklei%2Fmora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fmora/lists"}