OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
DocumentAccessBase.h
Go to the documentation of this file.
1#pragma once
2#include <iostream>
3#include <string>
4
5#include <bsoncxx/types/value.hpp>
6#include <mongocxx/collection.hpp>
7#include <bsoncxx/stdx/optional.hpp>
8#include "bsoncxx/document/view_or_value.hpp"
9
10using BsonViewOrValue = bsoncxx::document::view_or_value;
11using bsoncxx::types::value;
12using BsonView = bsoncxx::document::view;
13using BsonValue = bsoncxx::document::value;
14using String = std::string;
15
16namespace DataStorageAPI
17{
19 {
20 public:
23
24 __declspec(dllexport) std::string InsertDocument(String jsonInsertValue, bool allowQueueing);
25 __declspec(dllexport) std::string InsertDocument(BsonViewOrValue jsonInsertValue, bool allowQueueing);
26
27 __declspec(dllexport) void FlushQueuedDocuments();
28
29 __declspec(dllexport) bsoncxx::stdx::optional<BsonValue> GetDocument(String jsonQueryFilter, String jsonSelectQuery);
30 __declspec(dllexport) bsoncxx::stdx::optional<BsonValue> GetDocument(BsonViewOrValue filterQuery, BsonViewOrValue selectQuery);
31 __declspec(dllexport) bsoncxx::stdx::optional<BsonValue> GetDocument(BsonViewOrValue filterQuery, BsonViewOrValue selectQuery, BsonViewOrValue sortQuery);
32
33 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::delete_result> DeleteDocument(String deleteQuery);
34 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::delete_result> DeleteDocument(BsonViewOrValue deleteQuery);
35 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::delete_result> DeleteDocuments(BsonViewOrValue deleteQuery);
36
37 // Mutile Insert, Get, Update and Delete methods
38 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::insert_many> InsertMultipleDocument(std::vector<String> jsonValue);
39 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::insert_many> InsertMultipleDocument(std::vector<BsonViewOrValue> jsonValue);
40
41 __declspec(dllexport) mongocxx::cursor GetAllDocument(String jsonQueryFilter, String jsonProjectionQuery, int limit);
42 __declspec(dllexport) mongocxx::cursor GetAllDocument(BsonViewOrValue queryFilter, BsonViewOrValue projectionQuery, int limit);
43 __declspec(dllexport) mongocxx::cursor GetAllDocument(BsonViewOrValue queryFilter, BsonViewOrValue projectionQuery, BsonViewOrValue sortQuery, int limit);
44
45 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::delete_result> DeleteMultipleDocument(String deleteQuery);
46 __declspec(dllexport) bsoncxx::stdx::optional<mongocxx::result::delete_result> DeleteMultipleDocument(BsonViewOrValue deleteQuery);
47
48 protected:
49 mongocxx::collection mongoCollection;
50
51 private:
52 std::string mongoDbName;
53 std::string mongoCollectionName;
54 };
55}
56
bsoncxx::document::view_or_value BsonViewOrValue
Definition DocumentAccess.h:12
bsoncxx::document::view BsonView
Definition DocumentAccessBase.h:12
std::string String
Definition DocumentAccessBase.h:14
bsoncxx::document::value BsonValue
Definition DocumentAccessBase.h:13
Definition DocumentAccessBase.h:19
DocumentAccessBase()
Definition DocumentAccessBase.h:22
mongocxx::collection mongoCollection
Definition DocumentAccessBase.h:46
String collectionName
Definition DocumentAccessBase.h:21
__declspec(dllexport) std __declspec(dllexport) std __declspec(dllexport) void FlushQueuedDocuments()
__declspec(dllexport) DocumentAccessBase(String databaseName
Definition ArrayBinaryConverter.h:3