knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
BulkOperation.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_MONGO_BULK_OPERATION_H
7 #define KNOWROB_MONGO_BULK_OPERATION_H
8 
9 #include <mongoc.h>
10 #include <memory>
11 
12 namespace knowrob::mongo {
16  class BulkOperation {
17  public:
24  explicit BulkOperation(mongoc_bulk_operation_t *handle);
25 
26  BulkOperation(const BulkOperation &) = delete;
27 
29 
34  void pushInsert(const bson_t *document);
35 
40  void pushRemoveAll(const bson_t *document);
41 
46  void pushRemoveOne(const bson_t *document);
47 
53  void pushUpdate(bson_t *query, bson_t *update);
54 
59  void execute();
60 
64  bool empty() const { return empty_; }
65 
66  protected:
67  mongoc_bulk_operation_t *handle_;
68  bool empty_ = true;
69 
71  };
72 
73 } // knowrob
74 
75 #endif //KNOWROB_MONGO_BULK_OPERATION_H
void pushRemoveOne(const bson_t *document)
BulkOperation(const BulkOperation &)=delete
mongoc_bulk_operation_t * handle_
Definition: BulkOperation.h:67
void pushUpdate(bson_t *query, bson_t *update)
BulkOperation(mongoc_bulk_operation_t *handle)
void pushRemoveAll(const bson_t *document)
void pushInsert(const bson_t *document)