aboutsummaryrefslogtreecommitdiff
path: root/db/mongo_access.cpp
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-08-08 13:48:39 +0200
committerneodarz <neodarz@neodarz.net>2019-08-08 13:48:39 +0200
commit4671f4a46bf9aca39f0a09d0bec115a7f8913614 (patch)
tree8ed81cc3fcd0a656340fdfe4ae422ce22c5738d2 /db/mongo_access.cpp
parent889093b2ea55969e8c2920652bdf36bfa3a04cc2 (diff)
downloadumosapicpp-4671f4a46bf9aca39f0a09d0bec115a7f8913614.tar.xz
umosapicpp-4671f4a46bf9aca39f0a09d0bec115a7f8913614.zip
Implement mongocxx pool connection
Diffstat (limited to '')
-rw-r--r--db/mongo_access.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/mongo_access.cpp b/db/mongo_access.cpp
new file mode 100644
index 0000000..56936f3
--- /dev/null
+++ b/db/mongo_access.cpp
@@ -0,0 +1,16 @@
+#include "mongo_access.h"
+
+mongo_access::mongo_access(void) {};
+mongo_access::~mongo_access(void) {};
+
+void mongo_access::configure(mongocxx::uri uri) {
+ class noop_logger : public mongocxx::logger {
+ public:
+ virtual void operator()(mongocxx::log_level,
+ bsoncxx::stdx::string_view,
+ bsoncxx::stdx::string_view) noexcept {}
+ };
+
+ _pool = bsoncxx::stdx::make_unique<mongocxx::pool>(std::move(uri));
+ _instance = bsoncxx::stdx::make_unique<mongocxx::instance>(bsoncxx::stdx::make_unique<noop_logger>());
+}