MongoDB C++ Driver  mongocxx-3.5.1
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
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:
51  find& allow_partial_results(bool allow_partial);
52 
60  const stdx::optional<bool>& allow_partial_results() const;
61 
74  find& batch_size(std::int32_t batch_size);
75 
83  const stdx::optional<std::int32_t>& batch_size() const;
84 
97  find& collation(bsoncxx::document::view_or_value collation);
98 
107  const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
108 
122  find& comment(bsoncxx::string::view_or_value comment);
123 
131  const stdx::optional<bsoncxx::string::view_or_value>& comment() const;
132 
145  find& cursor_type(cursor::type cursor_type);
146 
154  const stdx::optional<cursor::type>& cursor_type() const;
155 
171  find& hint(class hint index_hint);
172 
180  const stdx::optional<class hint>& hint() const;
181 
193  find& limit(std::int64_t limit);
194 
202  const stdx::optional<std::int64_t>& limit() const;
203 
217 
225  const stdx::optional<bsoncxx::document::view_or_value>& max() const;
226 
244  find& max_await_time(std::chrono::milliseconds max_await_time);
245 
254  const stdx::optional<std::chrono::milliseconds>& max_await_time() const;
255 
268  find& max_time(std::chrono::milliseconds max_time);
269 
277  const stdx::optional<std::chrono::milliseconds>& max_time() const;
278 
292 
300  const stdx::optional<bsoncxx::document::view_or_value>& min() const;
301 
315  find& no_cursor_timeout(bool no_cursor_timeout);
316 
324  const stdx::optional<bool>& no_cursor_timeout() const;
325 
338  find& projection(bsoncxx::document::view_or_value projection);
339 
347  const stdx::optional<bsoncxx::document::view_or_value>& projection() const;
348 
362 
371  const stdx::optional<class read_preference>& read_preference() const;
372 
387  find& return_key(bool return_key);
388 
399  const stdx::optional<bool>& return_key() const;
400 
413  find& show_record_id(bool show_record_id);
414 
424  const stdx::optional<bool>& show_record_id() const;
425 
438  find& skip(std::int64_t skip);
439 
447  const stdx::optional<std::int64_t>& skip() const;
448 
462  find& sort(bsoncxx::document::view_or_value ordering);
463 
471  const stdx::optional<bsoncxx::document::view_or_value>& sort() const;
472 
473  private:
474  stdx::optional<bool> _allow_partial_results;
475  stdx::optional<std::int32_t> _batch_size;
476  stdx::optional<bsoncxx::document::view_or_value> _collation;
477  stdx::optional<bsoncxx::string::view_or_value> _comment;
478  stdx::optional<cursor::type> _cursor_type;
479  stdx::optional<class hint> _hint;
480  stdx::optional<std::int64_t> _limit;
481  stdx::optional<bsoncxx::document::view_or_value> _max;
482  stdx::optional<std::chrono::milliseconds> _max_await_time;
483  stdx::optional<std::chrono::milliseconds> _max_time;
484  stdx::optional<bsoncxx::document::view_or_value> _min;
485  stdx::optional<bool> _no_cursor_timeout;
486  stdx::optional<bsoncxx::document::view_or_value> _projection;
487  stdx::optional<class read_preference> _read_preference;
488  stdx::optional<bool> _return_key;
489  stdx::optional<bool> _show_record_id;
490  stdx::optional<std::int64_t> _skip;
491  stdx::optional<bsoncxx::document::view_or_value> _ordering;
492 };
493 
494 } // namespace options
495 MONGOCXX_INLINE_NAMESPACE_END
496 } // namespace mongocxx
497 
498 #include <mongocxx/config/postlude.hpp>
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
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:32
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:62
Class representing a view-or-value variant type.
Definition: view_or_value.hpp:30
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:36