MongoDB C++ Driver 4.4.0
Loading...
Searching...
No Matches
client_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/v1/client_bulk_write-fwd.hpp> // IWYU pragma: export
18
19//
20
22
25
29
36
39
40#include <cstdint>
41#include <memory>
42
43namespace mongocxx {
44namespace v1 {
45
59 private:
60 class impl;
61 void* _impl;
62
63 public:
64 class options;
65 class result;
67
74
79
87
95
99 client_bulk_write(client_bulk_write const& other) = delete;
100
104 client_bulk_write& operator=(client_bulk_write const& other) = delete;
105
112 append(bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view document, insert_one_options const& opts);
113
120 bsoncxx::v1::stdx::string_view ns,
121 bsoncxx::v1::document::view filter,
122 bsoncxx::v1::document::view update,
123 update_one_options const& opts);
124
131 bsoncxx::v1::stdx::string_view ns,
132 bsoncxx::v1::document::view filter,
133 v1::pipeline const& update,
134 update_one_options const& opts);
135
142 bsoncxx::v1::stdx::string_view ns,
143 bsoncxx::v1::document::view filter,
144 bsoncxx::v1::document::view update,
145 update_many_options const& opts);
146
153 bsoncxx::v1::stdx::string_view ns,
154 bsoncxx::v1::document::view filter,
155 v1::pipeline const& update,
156 update_many_options const& opts);
157
164 bsoncxx::v1::stdx::string_view ns,
165 bsoncxx::v1::document::view filter,
166 bsoncxx::v1::document::view replacement,
167 replace_one_options const& opts);
168
175 append(bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, delete_one_options const& opts);
176
183 append(bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view filter, delete_many_options const& opts);
184
193 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<result>) execute(options const& opts);
194
195 class internal;
196
197 private:
198 /* explicit(false) */ client_bulk_write(void* bulk);
199};
200
216 private:
217 class impl;
218 void* _impl;
219
220 public:
227
235
242 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options&& other) noexcept;
243
248
252 MONGOCXX_ABI_EXPORT_CDECL(options&) operator=(options const& other);
253
258
263
268
273
277 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::types::view>) comment() const;
278
283
287 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) let() const;
288
293
297 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bool>) ordered() const;
298
303
307 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bool>) verbose_results() const;
308
313
318
319 class internal;
320};
321
337 private:
338 class impl;
339 void* _impl;
340
341 public:
348
356
363 MONGOCXX_ABI_EXPORT_CDECL(result&) operator=(result&& other) noexcept;
364
369
373 MONGOCXX_ABI_EXPORT_CDECL(result&) operator=(result const& other);
374
379
384
389
394
399
405 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) insert_results() const;
406
412 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) update_results() const;
413
419 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) delete_results() const;
420
421 class internal;
422
423 private:
424 /* explicit(false) */ result(void* impl);
425};
426
427BSONCXX_PRIVATE_WARNINGS_PUSH();
428BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4251));
429BSONCXX_PRIVATE_WARNINGS_DISABLE(MSVC(4275));
430
437class client_bulk_write::exception : public v1::exception {
438 private:
439 class impl;
440 std::shared_ptr<impl> _impl;
441
442 public:
449
456
463
470
471 class internal;
472
473 private:
474 MONGOCXX_ABI_NO_EXPORT /* explicit(false) */
475 exception(v1::exception e, std::unique_ptr<impl> impl);
476
477 MONGOCXX_ABI_NO_EXPORT void key_function() const override;
478};
479
480BSONCXX_PRIVATE_WARNINGS_POP();
481
482BSONCXX_PRIVATE_WARNINGS_PUSH();
483BSONCXX_PRIVATE_WARNINGS_DISABLE(Clang("-Wunused-private-field"));
484
530
531BSONCXX_PRIVATE_WARNINGS_POP();
532
544 private:
545 class impl;
546 void* _impl;
547
548 public:
555
563
571
576
581
586
591
595 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::array::view>) array_filters() const;
596
601
605 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) collation() const;
606
611
615 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<v1::hint>) hint() const;
616
621
625 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) sort() const;
626
631
635 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bool>) upsert() const;
636
637 class internal;
638};
639
735
831
905
979
980} // namespace v1
981} // namespace mongocxx
982
983#include <mongocxx/v1/detail/postlude.hpp>
984
For internal use only!
A non-owning, read-only BSON array.
Definition view.hpp:47
A non-owning, read-only BSON document.
Definition view.hpp:52
A polyfill for std::optional<T>.
Definition optional.hpp:799
Options for a "Delete Many" operation in a client bulk write.
Definition client_bulk_write.hpp:913
delete_many_options(delete_many_options &&other) noexcept
Move constructor.
Options for a "Delete One" operation in a client bulk write.
Definition client_bulk_write.hpp:839
delete_one_options(delete_one_options &&other) noexcept
Move constructor.
A client bulk write error.
Definition client_bulk_write.hpp:437
Options for an "Insert One" operation in a client bulk write.
Definition client_bulk_write.hpp:488
Options for a client bulk write operation.
Definition client_bulk_write.hpp:215
options(options &&other) noexcept
Move constructor.
Options for a "Replace One" operation in a client bulk write.
Definition client_bulk_write.hpp:745
replace_one_options(replace_one_options &&other) noexcept
Move constructor.
The result of a client bulk write operation.
Definition client_bulk_write.hpp:336
result(result &&other) noexcept
Move constructor.
Options for an "Update Many" operation in a client bulk write.
Definition client_bulk_write.hpp:649
update_many_options(update_many_options &&other) noexcept
Move constructor.
Options for an "Update One" operation in a client bulk write.
Definition client_bulk_write.hpp:543
update_one_options(update_one_options &&other) noexcept
Move constructor.
client_bulk_write(client_bulk_write &&other) noexcept
Move constructor.
Options for a "Delete Many" operation in a client bulk write.
Definition client_bulk_write.hpp:913
delete_many_options & hint(v1::hint v)
Set the "hint" field.
delete_many_options & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
delete_many_options(delete_many_options &&other) noexcept
Move constructor.
Options for a "Delete One" operation in a client bulk write.
Definition client_bulk_write.hpp:839
delete_one_options & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
delete_one_options & hint(v1::hint v)
Set the "hint" field.
delete_one_options(delete_one_options &&other) noexcept
Move constructor.
bsoncxx::v1::array::view write_concern_errors() const
An array of write concern errors.
bsoncxx::v1::document::view error_reply() const
The server reply associated with the error, if any.
bsoncxx::v1::document::view write_errors() const
A document mapping model index to the corresponding write error.
bsoncxx::v1::stdx::optional< result > partial_result() const
The partial result obtained before the error occurred, if any.
Options for an "Insert One" operation in a client bulk write.
Definition client_bulk_write.hpp:488
insert_one_options(insert_one_options &&other) noexcept
Move constructor.
Options for a client bulk write operation.
Definition client_bulk_write.hpp:215
options & verbose_results(bool v)
Set the "verboseResults" field.
options & bypass_document_validation(bool v)
Set the "bypassDocumentValidation" field.
options & ordered(bool v)
Set the "ordered" field.
options & write_concern(v1::write_concern v)
Set the "writeConcern" field.
options & let(bsoncxx::v1::document::value v)
Set the "let" field.
options & comment(bsoncxx::v1::types::value v)
Set the "comment" field.
options(options &&other) noexcept
Move constructor.
Options for a "Replace One" operation in a client bulk write.
Definition client_bulk_write.hpp:745
replace_one_options(replace_one_options &&other) noexcept
Move constructor.
replace_one_options & hint(v1::hint v)
Set the "hint" field.
replace_one_options & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
replace_one_options & upsert(bool v)
Set the "upsert" field.
replace_one_options & sort(bsoncxx::v1::document::value v)
Set the "sort" field.
The result of a client bulk write operation.
Definition client_bulk_write.hpp:336
std::int64_t deleted_count() const
Return the number of documents deleted.
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > update_results() const
Return the per-operation update results as a document mapping model index to the update result.
std::int64_t matched_count() const
Return the number of documents matched by update or replace operations.
std::int64_t modified_count() const
Return the number of documents modified by update or replace operations.
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > delete_results() const
Return the per-operation delete results as a document mapping model index to the delete result.
bsoncxx::v1::stdx::optional< bsoncxx::v1::document::view > insert_results() const
Return the per-operation insert results as a document mapping model index to the insert result.
std::int64_t upserted_count() const
Return the number of documents upserted.
std::int64_t inserted_count() const
Return the number of documents inserted.
result(result &&other) noexcept
Move constructor.
Options for an "Update Many" operation in a client bulk write.
Definition client_bulk_write.hpp:649
update_many_options & upsert(bool v)
Set the "upsert" field.
update_many_options & array_filters(bsoncxx::v1::array::value v)
Set the "arrayFilters" field.
update_many_options & hint(v1::hint v)
Set the "hint" field.
update_many_options(update_many_options &&other) noexcept
Move constructor.
update_many_options & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
Options for an "Update One" operation in a client bulk write.
Definition client_bulk_write.hpp:543
update_one_options(update_one_options &&other) noexcept
Move constructor.
update_one_options & hint(v1::hint v)
Set the "hint" field.
update_one_options & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
update_one_options & array_filters(bsoncxx::v1::array::value v)
Set the "arrayFilters" field.
update_one_options & sort(bsoncxx::v1::document::value v)
Set the "sort" field.
update_one_options & upsert(bool v)
Set the "upsert" field.
client_bulk_write(client_bulk_write &&other) noexcept
Move constructor.
client_bulk_write & append(bsoncxx::v1::stdx::string_view ns, bsoncxx::v1::document::view document, insert_one_options const &opts)
Append an "Insert One" operation targeting the given namespace.
bsoncxx::v1::stdx::optional< result > execute(options const &opts)
Execute the appended operations.
~client_bulk_write()
Destroy this object.
Base class for all exceptions thrown by mongocxx::v1.
Definition exception.hpp:89
A MongoDB aggregation pipeline.
Definition pipeline.hpp:41
Provides macros to control the set of symbols exported in the ABI.
#define MONGOCXX_ABI_CDECL
Expands to __cdecl when built with MSVC on Windows.
Definition export.hpp:49
#define MONGOCXX_ABI_NO_EXPORT
Excludes the associated entity from being part of the ABI.
Definition export.hpp:20
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
#define MONGOCXX_ABI_EXPORT
Exports the associated entity as part of the ABI.
Definition export.hpp:15
The mongocxx v1 macro guard prelude header.
Provides mongocxx error-handling utilities.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is guaranteed for documented symbols.
The top-level namespace within which all mongocxx library entities are declared.
Provides bsoncxx::v1::array::value.
Declares bsoncxx::v1::array::view.
Declares mongocxx::v1::client_bulk_write.
Provides bsoncxx::v1::document::value.
Declares bsoncxx::v1::document::view.
Declares mongocxx::v1::hint.
Declares mongocxx::v1::pipeline.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.
Provides bsoncxx::v1::types::value.
Declares mongocxx::v1::write_concern.