MongoDB C++ Driver  mongocxx-3.3.0
All Classes Namespaces Functions Enumerations Enumerator Friends Pages
bulk_write.hpp
1 // Copyright 2014-present MongoDB Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <mongocxx/client_session.hpp>
18 #include <mongocxx/model/write.hpp>
19 #include <mongocxx/options/bulk_write.hpp>
20 #include <mongocxx/result/bulk_write.hpp>
21 
22 #include <mongocxx/config/prelude.hpp>
23 
24 namespace mongocxx {
25 MONGOCXX_INLINE_NAMESPACE_BEGIN
26 
27 class collection;
28 
43 class MONGOCXX_API bulk_write {
44  public:
45  struct deprecated_tag {};
57  MONGOCXX_DEPRECATED explicit bulk_write(options::bulk_write options = {});
58  explicit bulk_write(deprecated_tag, options::bulk_write options = {});
59 
63  bulk_write(bulk_write&&) noexcept;
64 
68  bulk_write& operator=(bulk_write&&) noexcept;
69 
73  ~bulk_write();
74 
97  bulk_write& append(const model::write& operation);
98 
108  stdx::optional<result::bulk_write> execute() const;
109 
110  private:
111  friend class collection;
112 
113  class MONGOCXX_PRIVATE impl;
114 
115  MONGOCXX_PRIVATE bulk_write(const collection& coll,
116  const options::bulk_write& options,
117  const client_session* session = nullptr);
118 
119  bool _created_from_collection;
120  std::unique_ptr<impl> _impl;
121 };
122 
123 MONGOCXX_INLINE_NAMESPACE_END
124 } // namespace mongocxx
125 
126 #include <mongocxx/config/postlude.hpp>
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
Definition: error_code.hpp:117
Class representing the optional arguments to a MongoDB bulk write.
Definition: bulk_write.hpp:29
Definition: bulk_write.hpp:45
Class representing a batch of write operations that can be sent to the server as a group...
Definition: bulk_write.hpp:43
Class representing server side document groupings within a MongoDB database.
Definition: collection.hpp:87