MongoDB C++ Driver  mongocxx-3.10.2
distinct.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/distinct-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/read_preference.hpp>
27 
28 #include <mongocxx/config/prelude.hpp>
29 
30 namespace mongocxx {
31 namespace v_noabi {
32 namespace options {
33 
37 class distinct {
38  public:
52 
61  const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& collation() const;
62 
75  distinct& max_time(std::chrono::milliseconds max_time);
76 
84  const stdx::optional<std::chrono::milliseconds>& max_time() const;
85 
99 
107  const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& comment() const;
108 
122 
130  const stdx::optional<mongocxx::v_noabi::read_preference>& read_preference() const;
131 
132  private:
133  stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
134  stdx::optional<std::chrono::milliseconds> _max_time;
135  stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _comment;
136  stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
137 };
138 
139 } // namespace options
140 } // namespace v_noabi
141 } // namespace mongocxx
142 
143 #include <mongocxx/config/postlude.hpp>
Class representing the optional arguments to a MongoDB distinct command.
Definition: distinct.hpp:37
const stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time setting.
const stdx::optional< mongocxx::v_noabi::read_preference > & read_preference() const
The current read_preference for this operation.
distinct & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the collation for this operation.
distinct & max_time(std::chrono::milliseconds max_time)
Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
distinct & comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment)
Sets the comment for this operation.
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & comment() const
The current comment for this operation.
distinct & 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.
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