MongoDB C++ Driver  mongocxx-3.10.2
count.hpp
1 // Copyright 2014 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 <chrono>
18 #include <cstdint>
19 #include <string>
20 
21 #include <mongocxx/options/count-fwd.hpp>
22 
23 #include <bsoncxx/document/view_or_value.hpp>
24 #include <bsoncxx/stdx/optional.hpp>
25 #include <bsoncxx/types/bson_value/view_or_value.hpp>
26 #include <mongocxx/hint.hpp>
27 #include <mongocxx/read_preference.hpp>
28 
29 #include <mongocxx/config/prelude.hpp>
30 
31 namespace mongocxx {
32 namespace v_noabi {
33 namespace options {
34 
38 class count {
39  public:
53 
62  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& collation() const;
63 
77 
85  const stdx::optional<mongocxx::v_noabi::hint>& hint() const;
86 
100 
108  const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& comment() const;
109 
122  count& limit(std::int64_t limit);
123 
131  const stdx::optional<std::int64_t>& limit() const;
132 
145  count& max_time(std::chrono::milliseconds max_time);
146 
154  const stdx::optional<std::chrono::milliseconds>& max_time() const;
155 
168  count& skip(std::int64_t skip);
169 
177  const stdx::optional<std::int64_t>& skip() const;
178 
192 
200  const stdx::optional<mongocxx::v_noabi::read_preference>& read_preference() const;
201 
202  private:
203  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
204  stdx::optional<mongocxx::v_noabi::hint> _hint;
205  stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _comment;
206  stdx::optional<std::int64_t> _limit;
207  stdx::optional<std::chrono::milliseconds> _max_time;
208  stdx::optional<std::int64_t> _skip;
209  stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
210 };
211 
212 } // namespace options
213 } // namespace v_noabi
214 } // namespace mongocxx
215 
216 #include <mongocxx/config/postlude.hpp>
Class representing a hint to be passed to a database operation.
Definition: hint.hpp:34
Class representing the optional arguments to mongocxx::v_noabi::collection::count_documents.
Definition: count.hpp:38
const stdx::optional< mongocxx::v_noabi::read_preference > & read_preference() const
The current read_preference for this operation.
count & limit(std::int64_t limit)
Sets the maximum number of documents to count.
const stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time setting.
const stdx::optional< std::int64_t > & skip() const
Gets the current number of documents to skip.
const stdx::optional< std::int64_t > & limit() const
Gets the current limit.
count & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the collation for this operation.
count & hint(mongocxx::v_noabi::hint index_hint)
Sets the index to use for this operation.
const stdx::optional< mongocxx::v_noabi::hint > & hint() const
Gets the current hint.
count & read_preference(mongocxx::v_noabi::read_preference rp)
Sets the read_preference for this operation.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation() const
Retrieves the current collation for this operation.
count & skip(std::int64_t skip)
Sets the number of documents to skip before counting documents.
count & max_time(std::chrono::milliseconds max_time)
Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
count & comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment)
Set the value of the comment option.
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & comment() const
Gets the current value of the comment option.
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:63
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19