MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
delete_many.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/model/delete_many-fwd.hpp> // IWYU pragma: export
18
19//
20
22
23#include <mongocxx/v1/bulk_write.hpp> // IWYU pragma: export
24
25#include <utility>
26
30
31#include <mongocxx/hint.hpp>
32
34
35namespace mongocxx {
36namespace v_noabi {
37namespace model {
38
43 public:
48
52 explicit operator v1::bulk_write::delete_many() const {
54 using v_noabi::to_v1;
55
57
58 if (_collation) {
59 ret.collation(bsoncxx::v1::document::value{to_v1(_collation->view())});
60 }
61
62 if (_hint) {
63 ret.hint(to_v1(*_hint));
64 }
65
66 return ret;
67 }
68
76
83 return _filter;
84 }
85
100 _collation = std::move(collation);
101 return *this;
102 }
103
116
130 _hint = std::move(index_hint);
131 return *this;
132 }
133
140 return _hint;
141 }
142
143 private:
145
148};
149
150} // namespace model
151} // namespace v_noabi
152} // namespace mongocxx
153
154namespace mongocxx {
155namespace v_noabi {
156
161 return {std::move(v)};
162}
163
170
171} // namespace v_noabi
172} // namespace mongocxx
173
175
A BSON document.
Definition value.hpp:46
A polyfill for std::optional<T>.
Definition optional.hpp:799
delete_many(v1::bulk_write::delete_many op)
Construct with the mongocxx::v1 equivalent.
A single "Delete Many" write operation.
Definition bulk_write.hpp:675
delete_many & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
delete_many & hint(v1::hint v)
Set the "hint" field.
A batch of write operations that can be sent to the server as a group.
Definition bulk_write.hpp:54
The index to "hint" or force a MongoDB server to use when performing a query.
Definition hint.hpp:42
A MongoDB delete operation that removes multiple documents.
Definition delete_many.hpp:42
delete_many(bsoncxx::v_noabi::document::view_or_value filter)
Constructs a delete operation that will delete all documents matching the filter.
Definition delete_many.hpp:75
delete_many(v1::bulk_write::delete_many op)
Construct with the mongocxx::v1 equivalent.
delete_many & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the collation for this delete operation.
Definition delete_many.hpp:99
delete_many & hint(v_noabi::hint index_hint)
Sets the index to use for this operation.
Definition delete_many.hpp:129
bsoncxx::v_noabi::stdx::optional< v_noabi::hint > const & hint() const
Gets the current hint.
Definition delete_many.hpp:139
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & collation() const
Gets the collation option for this delete operation.
Definition delete_many.hpp:113
bsoncxx::v_noabi::document::view_or_value const & filter() const
Gets the filter for this delete operation.
Definition delete_many.hpp:82
Declares mongocxx::v_noabi::model::delete_many.
Provides bsoncxx::v_noabi::document::view_or_value.
#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.
v_noabi::view_or_value< v_noabi::document::view, v_noabi::document::value > view_or_value
Equivalent to v_noabi::view_or_value<v_noabi::document::view, v_noabi::document::value>.
Definition view_or_value.hpp:30
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
Declares entities whose ABI stability is guaranteed for documented symbols.
Declares entities representing bulk write operations.
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 bsoncxx::v1::document::value.
Provides bsoncxx::v_noabi::document::view.
Provides std::optional-related polyfills for library API usage.
Provides mongocxx::v_noabi::hint.