6 #include "knowrob/storage/mongo/ChangeStream.h"
7 #include "knowrob/storage/mongo/MongoException.h"
12 const std::shared_ptr<Collection> &collection,
15 : collection_(collection),
16 callback_(std::move(callback)),
20 bson_t *opts = BCON_NEW(
21 "maxAwaitTimeMS", BCON_INT32(1),
22 "fullDocument", BCON_UTF8(
"updateLookup")
32 mongoc_change_stream_destroy(
stream_);
45 if (mongoc_change_stream_next(
stream_, &doc)) {
52 const bson_t *err_doc;
54 if (mongoc_change_stream_error_document(
stream_, &error, &err_doc)) {
55 mongoc_change_stream_destroy(
stream_);
mongoc_change_stream_t * stream_
ChangeStream(const std::shared_ptr< Collection > &collection, const bson_t *query, ChangeStreamCallback callback)
std::shared_ptr< Collection > collection_
ChangeStreamCallback callback_
bson_wrapper_ptr next_ptr_
std::function< void(const bson_wrapper_ptr &)> ChangeStreamCallback