7#include <SimoxUtility/json.h>
11#include <bsoncxx/builder/stream/array.hpp>
12#include <bsoncxx/builder/stream/document.hpp>
13#include <bsoncxx/builder/stream/helpers.hpp>
14#include <bsoncxx/json.hpp>
15#include <mongocxx/client.hpp>
16#include <mongocxx/instance.hpp>
17#include <mongocxx/pool.hpp>
18#include <mongocxx/stdx.hpp>
19#include <mongocxx/uri.hpp>
26 inline const std::map<std::string, std::string>
EscapeTable = {{
"/",
"|"}};
28 std::string
escapeName(
const std::string& segmentName);
30 std::string
unescapeName(
const std::string& escapedName);
32 bool insert(mongocxx::collection& coll,
const nlohmann::json& value);
34 std::optional<nlohmann::json>
contains(mongocxx::collection& coll,
35 const nlohmann::json& value);
37 bool update(mongocxx::collection& coll,
38 const nlohmann::json&
query,
39 const std::string& vkey,
40 const nlohmann::json& vdata);
46 std::optional<mongocxx::database>
databaseExists(mongocxx::client&,
47 const std::string& databaseName);
49 const std::string& databaseName,
50 bool createIfNotExistent);
53 const std::string& collectionName);
55 const std::string& collectionName,
56 bool createIfNotExistent);
58 std::optional<nlohmann::json>
documentExists(mongocxx::collection& collection,
59 const nlohmann::json&
query);
62 const nlohmann::json&
query,
63 bool createIfNotExistent =
false);
66 const nlohmann::json&
query);
69 const nlohmann::json&
query,
70 const nlohmann::json&
data);
72 std::vector<nlohmann::json>
getAllDocuments(mongocxx::collection& collection);
std::string unescapeName(const std::string &escapedName)
std::string escapeName(const std::string &segmentName)
std::optional< nlohmann::json > contains(mongocxx::collection &coll, const nlohmann::json &value)
bool insert(mongocxx::collection &coll, const nlohmann::json &value)
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
const std::map< std::string, std::string > EscapeTable
std::optional< mongocxx::database > databaseExists(mongocxx::client &client, const std::string &databaseName)
mongocxx::collection ensureCollectionExists(mongocxx::database &db, const std::string &collectionName, bool createIfNotExistent)
std::optional< nlohmann::json > documentExists(mongocxx::collection &collection, const nlohmann::json &json)
std::vector< nlohmann::json > getAllDocuments(mongocxx::collection &collection)
void writeDataToDocument(mongocxx::collection &collection, const nlohmann::json &query, const nlohmann::json &update)
nlohmann::json ensureDocumentExists(mongocxx::collection &collection, const nlohmann::json &json, bool createIfNotExistent)
mongocxx::database ensureDatabaseExists(mongocxx::client &client, const std::string &databaseName, bool createIfNotExistent)
std::optional< mongocxx::collection > collectionExists(mongocxx::database &db, const std::string &collectionName)
nlohmann::json readDataFromDocument(mongocxx::collection &collection, const nlohmann::json &json)
std::string toCollectionName(const armem::MemoryID &id)
std::string toDocumentID(const armem::MemoryID &id)