MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
delete_one.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
18
19#include <mongocxx/model/delete_one-fwd.hpp> // IWYU pragma: export
20
21//
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_one() 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
96 _collation = std::move(collation);
97 return *this;
98 }
99
112
127 _hint = std::move(index_hint);
128 return *this;
129 }
130
137 return _hint;
138 }
139
140 private:
142
145};
146
147} // namespace model
148} // namespace v_noabi
149} // namespace mongocxx
150
151namespace mongocxx {
152namespace v_noabi {
153
158 return {std::move(v)};
159}
160
167
168} // namespace v_noabi
169} // namespace mongocxx
170
172
A BSON document.
Definition value.hpp:46
A polyfill for std::optional<T>.
Definition optional.hpp:799
delete_one(v1::bulk_write::delete_one op)
Construct with the mongocxx::v1 equivalent.
A single "Delete One" write operation.
Definition bulk_write.hpp:584
delete_one & hint(v1::hint v)
Set the "hint" field.
delete_one & collation(bsoncxx::v1::document::value v)
Set the "collation" 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 a single document.
Definition delete_one.hpp:42
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_one.hpp:109
delete_one(v1::bulk_write::delete_one op)
Construct with the mongocxx::v1 equivalent.
delete_one(bsoncxx::v_noabi::document::view_or_value filter)
Constructs a delete operation that will delete the first document matching the filter.
Definition delete_one.hpp:75
bsoncxx::v_noabi::document::view_or_value const & filter() const
Gets the filter on this delete operation.
Definition delete_one.hpp:82
delete_one & hint(v_noabi::hint index_hint)
Sets the index to use for this operation.
Definition delete_one.hpp:126
bsoncxx::v_noabi::stdx::optional< v_noabi::hint > const & hint() const
Gets the current hint.
Definition delete_one.hpp:136
delete_one & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the collation for this delete operation.
Definition delete_one.hpp:95
Declares mongocxx::v_noabi::model::delete_one.
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.