Loading...
Searching...
No Matches
delete_many.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/model/delete_many-fwd.hpp> // IWYU pragma: export
//
#include <bsoncxx/v1/document/value.hpp>
#include <mongocxx/v1/bulk_write.hpp> // IWYU pragma: export
#include <utility>
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/document/view_or_value.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <mongocxx/hint.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
namespace model {
class delete_many {
public:
/* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() delete_many(v1::bulk_write::delete_many op);
explicit operator v1::bulk_write::delete_many() const {
using bsoncxx::v_noabi::to_v1;
using v_noabi::to_v1;
v1::bulk_write::delete_many ret{bsoncxx::v1::document::value{to_v1(_filter.view())}};
if (_collation) {
ret.collation(bsoncxx::v1::document::value{to_v1(_collation->view())});
}
if (_hint) {
ret.hint(to_v1(*_hint));
}
return ret;
}
explicit delete_many(bsoncxx::v_noabi::document::view_or_value filter) : _filter{std::move(filter)} {}
bsoncxx::v_noabi::document::view_or_value const& filter() const {
return _filter;
}
delete_many& collation(bsoncxx::v_noabi::document::view_or_value collation) {
_collation = std::move(collation);
return *this;
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const& collation() const {
return _collation;
}
delete_many& hint(v_noabi::hint index_hint) {
_hint = std::move(index_hint);
return *this;
}
bsoncxx::v_noabi::stdx::optional<v_noabi::hint> const& hint() const {
return _hint;
}
private:
bsoncxx::v_noabi::document::view_or_value _filter;
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
bsoncxx::v_noabi::stdx::optional<v_noabi::hint> _hint;
};
} // namespace model
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
inline v_noabi::model::delete_many from_v1(v1::bulk_write::delete_many v) {
return {std::move(v)};
}
inline v1::bulk_write::delete_many to_v1(v_noabi::model::delete_many const& v) {
return v1::bulk_write::delete_many{v};
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
bsoncxx::v1::document::value
A BSON document.
Definition value.hpp:44
bsoncxx::v1::stdx::optional
A polyfill for std::optional<T>.
Definition optional.hpp:799
mongocxx::model::delete_many::delete_many
delete_many(v1::bulk_write::delete_many op)
Construct with the mongocxx::v1 equivalent.
mongocxx::v1::bulk_write::delete_many
A single "Delete Many" write operation.
Definition bulk_write.hpp:661
mongocxx::v1::bulk_write::delete_many::collation
delete_many & collation(bsoncxx::v1::document::value v)
Set the "collation" field.
mongocxx::v1::bulk_write::delete_many::hint
delete_many & hint(v1::hint v)
Set the "hint" field.
mongocxx::v_noabi::bulk_write
A batch of write operations that can be sent to the server as a group.
Definition bulk_write.hpp:54
mongocxx::v_noabi::hint
The index to "hint" or force a MongoDB server to use when performing a query.
Definition hint.hpp:42
mongocxx::v_noabi::model::delete_many
A MongoDB delete operation that removes multiple documents.
Definition delete_many.hpp:42
mongocxx::v_noabi::model::delete_many::delete_many
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
mongocxx::v_noabi::model::delete_many::delete_many
delete_many(v1::bulk_write::delete_many op)
Construct with the mongocxx::v1 equivalent.
mongocxx::v_noabi::model::delete_many::collation
delete_many & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the collation for this delete operation.
Definition delete_many.hpp:99
mongocxx::v_noabi::model::delete_many::hint
delete_many & hint(v_noabi::hint index_hint)
Sets the index to use for this operation.
Definition delete_many.hpp:129
mongocxx::v_noabi::model::delete_many::hint
bsoncxx::v_noabi::stdx::optional< v_noabi::hint > const & hint() const
Gets the current hint.
Definition delete_many.hpp:139
mongocxx::v_noabi::model::delete_many::collation
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
mongocxx::v_noabi::model::delete_many::filter
bsoncxx::v_noabi::document::view_or_value const & filter() const
Gets the filter for this delete operation.
Definition delete_many.hpp:82
delete_many-fwd.hpp
Declares mongocxx::v_noabi::model::delete_many.
view_or_value.hpp
Provides bsoncxx::v_noabi::document::view_or_value.
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
bsoncxx::v_noabi::document::view_or_value
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
bsoncxx::v_noabi::to_v1
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
mongocxx::v_noabi::model
Declares entities representing bulk write operations.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
mongocxx::v_noabi::to_v1
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
mongocxx::v_noabi::from_v1
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
bulk_write.hpp
Provides entities related to write operations.
value.hpp
Provides bsoncxx::v1::document::value.
view.hpp
Provides bsoncxx::v_noabi::document::view.
optional.hpp
Provides std::optional-related polyfills for library API usage.
hint.hpp
Provides mongocxx::v_noabi::hint.