diff options
Diffstat (limited to 'src/mongoStub.cpp')
-rw-r--r-- | src/mongoStub.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mongoStub.cpp b/src/mongoStub.cpp new file mode 100644 index 00000000..50312fc6 --- /dev/null +++ b/src/mongoStub.cpp @@ -0,0 +1,26 @@ +#include "mongoStub.hpp" + +mongoStub::mongoStub() { + if (this->client) { + this->db = client["fosscord"]; + + if (this->db) { + this->col = db["events"]; + + } else { + std::cout << "db not found"; + exit(-1); + } + } else { + std::cout << "Client couldn't be initialized"; + exit(-1); + } +} + +std::vector<std::string>mongoStub::getNewMessages(mongocxx::change_stream* colCs) { + std::vector<std::string> retVec; + for (const auto& event : *colCs) { + retVec.push_back(bsoncxx::to_json(event)); + } + return retVec; +} |