MongoDB C++ Driver  mongocxx-3.0.2
find.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 
20 #include <bsoncxx/document/view_or_value.hpp>
21 #include <bsoncxx/stdx/optional.hpp>
22 #include <bsoncxx/string/view_or_value.hpp>
23 #include <mongocxx/cursor.hpp>
24 #include <mongocxx/hint.hpp>
25 #include <mongocxx/read_preference.hpp>
26 
27 #include <mongocxx/config/prelude.hpp>
28 
29 namespace mongocxx {
30 MONGOCXX_INLINE_NAMESPACE_BEGIN
31 namespace options {
32 
36 class MONGOCXX_API find {
37  public:
47  find& allow_partial_results(bool allow_partial);
48 
56  const stdx::optional<bool>& allow_partial_results() const;
57 
66  find& batch_size(std::int32_t batch_size);
67 
75  const stdx::optional<std::int32_t>& batch_size() const;
76 
86  find& comment(bsoncxx::string::view_or_value comment);
87 
95  const stdx::optional<bsoncxx::string::view_or_value>& comment() const;
96 
105  find& cursor_type(cursor::type cursor_type);
106 
114  const stdx::optional<cursor::type>& cursor_type() const;
115 
127  find& hint(class hint index_hint);
128 
134  const stdx::optional<class hint>& hint() const;
135 
142  find& limit(std::int32_t limit);
143 
149  const stdx::optional<std::int32_t>& limit() const;
150 
164  find& max_await_time(std::chrono::milliseconds max_await_time);
165 
172  const stdx::optional<std::chrono::milliseconds>& max_await_time() const;
173 
182  find& max_time(std::chrono::milliseconds max_time);
183 
191  const stdx::optional<std::chrono::milliseconds>& max_time() const;
192 
201  find& modifiers(bsoncxx::document::view_or_value modifiers);
202 
208  const stdx::optional<bsoncxx::document::view_or_value>& modifiers() const;
209 
219  find& no_cursor_timeout(bool no_cursor_timeout);
220 
228  const stdx::optional<bool>& no_cursor_timeout() const;
229 
238  find& projection(bsoncxx::document::view_or_value projection);
239 
247  const stdx::optional<bsoncxx::document::view_or_value>& projection() const;
248 
258 
267  const stdx::optional<class read_preference>& read_preference() const;
268 
277  find& skip(std::int32_t skip);
278 
286  const stdx::optional<std::int32_t>& skip() const;
287 
297  find& sort(bsoncxx::document::view_or_value ordering);
298 
306  const stdx::optional<bsoncxx::document::view_or_value>& sort() const;
307 
308  private:
309  stdx::optional<bool> _allow_partial_results;
310  stdx::optional<std::int32_t> _batch_size;
311  stdx::optional<bsoncxx::string::view_or_value> _comment;
312  stdx::optional<cursor::type> _cursor_type;
313  stdx::optional<class hint> _hint;
314  stdx::optional<std::int32_t> _limit;
315  stdx::optional<std::chrono::milliseconds> _max_await_time;
316  stdx::optional<std::chrono::milliseconds> _max_time;
317  stdx::optional<bsoncxx::document::view_or_value> _modifiers;
318  stdx::optional<bool> _no_cursor_timeout;
319  stdx::optional<bsoncxx::document::view_or_value> _projection;
320  stdx::optional<class read_preference> _read_preference;
321  stdx::optional<std::int32_t> _skip;
322  stdx::optional<bsoncxx::document::view_or_value> _ordering;
323 };
324 
325 } // namespace options
326 MONGOCXX_INLINE_NAMESPACE_END
327 } // namespace mongocxx
328 
329 #include <mongocxx/config/postlude.hpp>
Definition: bulk_write.hpp:22
Class representing the optional arguments to a MongoDB query.
Definition: find.hpp:36
Class representing a hint to be passed to a database operation.
Definition: hint.hpp:34
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:54
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:36