#ifndef MongoAccess_H_ #define MongoAccess_H_ #include #include #include #include #include #include #include #include #include #include class mongo_access { public: mongo_access (); ~mongo_access (); void configure(mongocxx::uri uri); using connection = mongocxx::pool::entry; connection get_connection() { return _pool->acquire(); } bsoncxx::stdx::optional try_get_connection() { return _pool->try_acquire(); } private: std::unique_ptr _instance = nullptr; std::unique_ptr _pool = nullptr; }; #endif