5#include <mongocxx/client.hpp>
6#include <mongocxx/pool.hpp>
7#include <mongocxx/instance.hpp>
15 class __declspec(dllexport) ConnectionAPI
18 static ConnectionAPI& getInstance();
20 static void establishConnection(
const std::string &serverURL,
const std::string &siteID,
const std::string &userName,
const std::string &userPassword);
23 void setMongoInstance(
int siteId, std::ostream* logger);
24 void configurePool(std::string connectionUri,
bool useDefaultUri =
false);
26 mongocxx::collection getCollection(std::string databaseName, std::string collectionName);
27 bool checkCollectionExists(std::string databaseName, std::string collectionName);
28 bool createCollection(std::string databaseName, std::string collectionName);
29 bool deleteCollection(std::string databaseName, std::string collectionName);
31 bool checkServerIsRunning(
void);
33 mongocxx::database getDatabase(std::string databaseName);
35 int getSiteId() {
return _siteId; };
37 static std::string
getMongoURL(std::string databaseURL, std::string dbUsername, std::string dbPassword);
41 bsoncxx::stdx::optional<connection> tryGetConnection();
43 ConnectionAPI() =
default;
44 std::unique_ptr<mongocxx::instance> _mongoInstance =
nullptr;
45 std::unique_ptr<mongocxx::pool> _pool =
nullptr;
mongocxx::pool::entry connection
Definition ConnectionAPI.h:9
std::string getMongoURL(std::string databaseURL, std::string dbUsername, std::string dbPassword)
Definition MongoURL.cpp:4
Definition ArrayBinaryConverter.h:3
void callMe(void)
Definition ConnectionAPI.cpp:17