MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
delete.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/result/delete-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/delete_many_result.hpp> // IWYU pragma: export
22#include <mongocxx/v1/delete_one_result.hpp> // IWYU pragma: export
23
24#include <cstdint>
25#include <utility>
26
28
30
31namespace mongocxx {
32namespace v_noabi {
33namespace result {
34
39 public:
43 explicit delete_result(v_noabi::result::bulk_write result) : _result{std::move(result)} {}
44
49
54
58 explicit MONGOCXX_ABI_EXPORT_CDECL() operator v1::delete_many_result() const;
59
63 explicit MONGOCXX_ABI_EXPORT_CDECL() operator v1::delete_one_result() const;
64
70 v_noabi::result::bulk_write const& result() const {
71 return _result;
72 }
73
79 std::int32_t deleted_count() const {
80 return _result.deleted_count();
81 }
82
83 friend bool operator==(delete_result const& lhs, delete_result const& rhs) {
84 return lhs._result == rhs._result;
85 }
86
87 friend bool operator!=(delete_result const& lhs, delete_result const& rhs) {
88 return !(lhs == rhs);
89 }
90
91 private:
93};
94
95} // namespace result
96} // namespace v_noabi
97} // namespace mongocxx
98
99namespace mongocxx {
100namespace v_noabi {
101
106 return {std::move(v)};
107}
108
113 return {std::move(v)};
114}
115
116// Ambiguous whether `v_noabi::result::delete_result` should be converted to `v1::delete_many_result` or
117// `v1::delete_one_result`. Require users to explicitly cast to the expected type instead.
118//
119// v1::delete_many_result to_v1(v_noabi::result::delete_result const& v);
120// v1::delete_one_result to_v1(v_noabi::result::delete_result const& v);
121
122} // namespace v_noabi
123} // namespace mongocxx
124
126
delete_result(v_noabi::result::bulk_write result)
Definition delete.hpp:43
The result of a "deleteMany" operation.
Definition delete_many_result.hpp:39
The result of a "deleteOne" operation.
Definition delete_one_result.hpp:42
The result of a MongoDB bulk write operation.
Definition bulk_write.hpp:43
The result of a MongoDB delete operation.
Definition delete.hpp:38
operator v1::delete_one_result() const
Convert to the mongocxx::v1 equivalent.
v_noabi::result::bulk_write const & result() const
Returns the bulk write result.
Definition delete.hpp:70
delete_result(v_noabi::result::bulk_write result)
Definition delete.hpp:43
std::int32_t deleted_count() const
Gets the number of documents that were deleted during this operation.
Definition delete.hpp:79
operator v1::delete_many_result() const
Convert to the mongocxx::v1 equivalent.
Provides mongocxx::v1::delete_many_result.
Provides mongocxx::v1::delete_one_result.
#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 representing the result of various commands.
Declares entities whose ABI stability is NOT guaranteed.
bool operator==(std::string str, hint const &hint)
Convenience methods to compare against an index name.
Definition hint.hpp:138
bool operator!=(hint const &hint, std::string str)
Convenience methods to compare against an index name.
Definition hint.hpp:143
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.
Declares mongocxx::v_noabi::result::delete_result.
Provides mongocxx::v_noabi::result::bulk_write.