MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
estimated_document_count.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/options/estimated_document_count-fwd.hpp> // IWYU pragma: export
18
19//
20
22
23#include <mongocxx/v1/estimated_document_count_options.hpp> // IWYU pragma: export
24
25#include <chrono>
26#include <utility>
27
31
33
35
36namespace mongocxx {
37namespace v_noabi {
38namespace options {
39
44 public:
49
55
59 explicit operator v1::estimated_document_count_options() const {
61
63
64 if (_max_time) {
65 ret.max_time(*_max_time);
66 }
67
68 if (_comment) {
69 ret.comment(bsoncxx::v1::types::value{to_v1(_comment->view())});
70 }
71
72 if (_read_preference) {
73 ret.read_preference(to_v1(*_read_preference));
74 }
75
76 return ret;
77 }
78
92 estimated_document_count& max_time(std::chrono::milliseconds max_time) {
93 _max_time = max_time;
94 return *this;
95 }
96
106 return _max_time;
107 }
108
126
138
153 _read_preference = std::move(rp);
154 return *this;
155 }
156
166 return _read_preference;
167 }
168
169 private:
173};
174
175} // namespace options
176} // namespace v_noabi
177} // namespace mongocxx
178
179namespace mongocxx {
180namespace v_noabi {
181
188
195
196} // namespace v_noabi
197} // namespace mongocxx
198
200
A polyfill for std::optional<T>.
Definition optional.hpp:799
A union of BSON type values.
Definition value.hpp:54
estimated_document_count()=default
Default initialization.
Options for an "estimatedDocumentCount" operation.
Definition estimated_document_count_options.hpp:49
estimated_document_count_options & comment(bsoncxx::v1::types::value comment)
Set the "comment" field.
estimated_document_count_options & max_time(std::chrono::milliseconds max_time)
Set the "maxTimeMS" field.
estimated_document_count_options & read_preference(v1::read_preference rp)
Set the "readPreference" field.
Used by mongocxx::v_noabi::collection::estimated_document_count.
Definition estimated_document_count.hpp:43
estimated_document_count & comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment)
Sets the comment for this operation.
Definition estimated_document_count.hpp:122
estimated_document_count & read_preference(v_noabi::read_preference rp)
Sets the read_preference for this operation.
Definition estimated_document_count.hpp:152
bsoncxx::v_noabi::stdx::optional< v_noabi::read_preference > const & read_preference() const
The current read_preference for this operation.
Definition estimated_document_count.hpp:165
estimated_document_count()=default
Default initialization.
estimated_document_count & max_time(std::chrono::milliseconds max_time)
Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
Definition estimated_document_count.hpp:92
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > const & comment() const
The current comment for this operation.
Definition estimated_document_count.hpp:135
bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > const & max_time() const
The current max_time setting.
Definition estimated_document_count.hpp:105
operator v1::estimated_document_count_options() const
Convert to the mongocxx::v1 equivalent.
Definition estimated_document_count.hpp:59
Describes how MongoDB clients route read operations to the members of a replica set or sharded cluste...
Definition read_preference.hpp:59
Declares mongocxx::v_noabi::options::estimated_document_count.
Provides mongocxx::v1::estimated_document_count_options.
#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< view, value > view_or_value
Equivalent to v_noabi::view_or_value<view, value>.
Definition view_or_value.hpp:31
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 options to use with various commands.
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 bsoncxx::v_noabi::types::bson_value::view_or_value.
Provides bsoncxx::v1::types::value.
Provides std::optional-related polyfills for library API usage.
Equivalent to bsoncxx/types/bson_value/view.hpp.
Provides mongocxx::v_noabi::read_preference.