{"id":19492812,"url":"https://github.com/oatpp/example-mongodb","last_synced_at":"2025-04-25T20:30:45.287Z","repository":{"id":65042702,"uuid":"267971084","full_name":"oatpp/example-mongodb","owner":"oatpp","description":"Example project how to work with MongoDB","archived":false,"fork":false,"pushed_at":"2024-04-22T21:29:24.000Z","size":28,"stargazers_count":10,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T22:51:19.017Z","etag":null,"topics":["cpp","example","mongodb","oatpp"],"latest_commit_sha":null,"homepage":"https://oatpp.io/","language":"C++","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/oatpp.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":"2020-05-29T23:00:22.000Z","updated_at":"2024-01-11T14:56:17.000Z","dependencies_parsed_at":"2024-11-07T00:35:42.271Z","dependency_job_id":null,"html_url":"https://github.com/oatpp/example-mongodb","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"52bc412115dfdceb35e6e2f971ab32b00c1b21a8"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Fexample-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oatpp","download_url":"https://codeload.github.com/oatpp/example-mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224015660,"owners_count":17241535,"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":["cpp","example","mongodb","oatpp"],"created_at":"2024-11-10T21:23:08.730Z","updated_at":"2024-11-10T21:23:09.937Z","avatar_url":"https://github.com/oatpp.png","language":"C++","readme":"# example-mongodb [![Build Status](https://dev.azure.com/lganzzzo/lganzzzo/_apis/build/status/oatpp.example-mongodb?branchName=master)](https://dev.azure.com/lganzzzo/lganzzzo/_build/latest?definitionId=27\u0026branchName=master)\n\nExample project how to work with MongoDB using [oatpp-mongo](https://github.com/oatpp/oatpp-mongo) mondule.\nProject is a web-service with basic CRUD and Swagger-UI.\n*Dockerfile and docker-compose.yaml files included.*\n\nMore About Oat++:\n\n- [Oat++ Website](https://oatpp.io/)\n- [Oat++ Github Repository](https://github.com/oatpp/oatpp)\n- [Get Started](https://oatpp.io/docs/start)\n\n## Overview\n\n### Dependencies\n\n- [oatpp](https://github.com/oatpp/oatpp)\n- [oatpp-swagger](https://github.com/oatpp/oatpp-swagger)\n- [oatpp-mongo](https://github.com/oatpp/oatpp-mongo)\n- [mongocxx](http://mongocxx.org/) - Temporary dependency. Until the oatpp-mongo driver will be ready-to-use*\n\n### Project layout\n\n```\n|- CMakeLists.txt                        // projects CMakeLists.txt\n|- src/\n|    |\n|    |- controller/                      // Folder containing Controller where all endpoints are declared\n|    |- db/                              // Database class is here \n|    |- dto/                             // DTOs are declared here\n|    |- App.cpp                          // main() is here\n|    |- AppComponent.hpp                 // Service configuration is loaded here\n|    |- SwaggerComponent.hpp             // Configuration for swagger-ui\n|    \n|- utility/install-oatpp-modules.sh      // utility script to install required oatpp-modules.\n|- Dockerfile                            // Dockerfile\n|- docker-compose.yaml                   // Docker-compose with this service and postgresql\n```\n\n## Build and Run\n\n### Using CMake\n\n**Requires** \n\n- mongocxx installed. To install mongocxx:  \n   - On Mac `$ brew install mongo-cxx-driver`\n   - On Linux - See Installing mongocxx on Linux section.\n   \n- `oatpp`, `oatpp-swagger`, `oatpp-mongo` modules installed. You may run `utility/install-oatpp-modules.sh` \nscript to install required oatpp modules.   \n\n```\n$ mkdir build \u0026\u0026 cd build\n$ cmake ..\n$ make \n$ ./example-mongodb  # - run application.\n```\n\n### In Docker\n\n#### Dockerfile\n\nTo run the web-service only:\n\n```\n$ docker build -t example-mongodb .\n$ docker run -p 8000:8000 -e DEMO_MONGO_CONN_STR='mongodb://localhost/UserDB' -t example-mongodb\n```\n\n#### docker-compose\n\nTo run both web-service and mongodb:\n\n```\n$ docker-compose up\n```\n\n\n### After run\n\nGo to [http://localhost:8000/swagger/ui](http://localhost:8000/swagger/ui) to try endpoints.\n\n## Installing mongocxx on Linux\n\nInstalling mongocxx on Linux is an unclear and painful process.\nSee [ubuntu-cmake-mongocxx/Dockerfile](https://github.com/oatpp/dockerfiles/blob/master/ci/ubuntu-cmake-mongocxx/Dockerfile)\nfor instructions that worked for us.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Fexample-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foatpp%2Fexample-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Fexample-mongodb/lists"}