MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
bulk_write.hpp
Go to the documentation of this file.
1// Copyright 2009-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/bulk_write-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/bulk_write.hpp> // IWYU pragma: export
22
23#include <utility>
24
25#include <mongocxx/collection-fwd.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
26
28
29#include <mongocxx/client_session.hpp> // IWYU pragma: keep: backward compatibility, to be removed.
33
35
36namespace mongocxx {
37namespace v_noabi {
38
55 private:
56 v1::bulk_write _bulk;
57
58 public:
62 bulk_write(bulk_write&&) noexcept = default;
63
67 bulk_write& operator=(bulk_write&&) noexcept = default;
68
72 bulk_write(bulk_write const& other) = delete;
73
77 bulk_write& operator=(bulk_write const& other) = delete;
78
82 ~bulk_write() = default;
83
87 /* explicit(false) */ bulk_write(v1::bulk_write bulk) : _bulk{std::move(bulk)} {}
88
95 explicit operator v1::bulk_write() && {
96 return std::move(_bulk);
97 }
98
102 explicit operator v1::bulk_write() const& = delete;
103
109 bool empty() const noexcept {
110 return _bulk.empty();
111 }
112
136
148
149 class internal;
150};
151
156 return {std::move(v)};
157}
158
163 return v1::bulk_write{std::move(v)};
164}
165
166} // namespace v_noabi
167} // namespace mongocxx
168
170
A polyfill for std::optional<T>.
Definition optional.hpp:799
bulk_write(bulk_write &&) noexcept=default
Move constructs a bulk write operation.
A list of bulk write operations.
Definition bulk_write.hpp:55
A batch of write operations that can be sent to the server as a group.
Definition bulk_write.hpp:54
bulk_write(bulk_write &&) noexcept=default
Move constructs a bulk write operation.
bool empty() const noexcept
Checks if a bulk write operation is empty.
Definition bulk_write.hpp:109
bsoncxx::v_noabi::stdx::optional< result::bulk_write > execute() const
Executes a bulk write.
bulk_write & append(v_noabi::model::write const &operation)
Appends a single write to the bulk write operation. The write operation's contents are copied into th...
A single write operation for use with mongocxx::v_noabi::bulk_write.
Definition write.hpp:45
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
Declares entities whose ABI stability is guaranteed for documented symbols.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Provides entities related to write operations.
Provides std::optional-related polyfills for library API usage.
Declares mongocxx::v_noabi::bulk_write.
Provides mongocxx::v_noabi::client_session.
Declares mongocxx::v_noabi::collection.
Provides mongocxx::v_noabi::options::bulk_write.
Provides mongocxx::v_noabi::result::bulk_write.
Provides mongocxx::v_noabi::model::write.