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);