MongoDB C++ Driver  mongocxx-3.6.0
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:
55  find& allow_disk_use(bool allow_disk_use);
56 
64  const stdx::optional<bool>& allow_disk_use() const;
65 
79  find& allow_partial_results(bool allow_partial);
80 
88  const stdx::optional<bool>& allow_partial_results() const;
89 
102  find& batch_size(std::int32_t batch_size);
103 
111  const stdx::optional<std::int32_t>& batch_size() const;
112 
125  find& collation(bsoncxx::document::view_or_value collation);
126 
135  const stdx::optional<bsoncxx::document::view_or_value>& collation() const;
136 
150  find& comment(bsoncxx::string::view_or_value comment);
151 
159  const stdx::optional<bsoncxx::string::view_or_value>& comment() const;
160 
173  find& cursor_type(cursor::type cursor_type);
174 
182  const stdx::optional<cursor::type>& cursor_type() const;
183 
199  find& hint(class hint index_hint);
200 
208  const stdx::optional<class hint>& hint() const;
209 
221  find& limit(std::int64_t limit);
222 
230  const stdx::optional<std::int64_t>& limit() const;
231 
245 
253  const stdx::optional<bsoncxx::document::view_or_value>& max() const;
254 
272  find& max_await_time(std::chrono::milliseconds max_await_time);
273 
282  const stdx::optional<std::chrono::milliseconds>& max_await_time() const;
283 
296  find& max_time(std::chrono::milliseconds max_time);
297 
305  const stdx::optional<std::chrono::milliseconds>& max_time() const;
306 
320 
328  const stdx::optional<bsoncxx::document::view_or_value>& min() const;
329 
343  find& no_cursor_timeout(bool no_cursor_timeout);
344 
352  const stdx::optional<bool>& no_cursor_timeout() const;
353 
366  find& projection(bsoncxx::document::view_or_value projection);
367 
375  const stdx::optional<bsoncxx::document::view_or_value>& projection() const;
376 
390 
399  const stdx::optional<class read_preference>& read_preference() const;
400 
415  find& return_key(bool return_key);
416 
427  const stdx::optional<bool>& return_key() const;
428 
441  find& show_record_id(bool show_record_id);
442 
452  const stdx::optional<bool>& show_record_id() const;
453 
466  find& skip(std::int64_t skip);
467 
475  const stdx::optional<std::int64_t>& skip() const;
476 
490  find& sort(bsoncxx::document::view_or_value ordering);
491 
499  const stdx::optional<bsoncxx::document::view_or_value>& sort() const;
500 
501  private:
502  stdx::optional<bool> _allow_disk_use;
503  stdx::optional<bool> _allow_partial_results;
504  stdx::optional<std::int32_t> _batch_size;
505  stdx::optional<bsoncxx::document::view_or_value> _collation;
506  stdx::optional<bsoncxx::string::view_or_value> _comment;
507  stdx::optional<cursor::type> _cursor_type;
508  stdx::optional<class hint> _hint;
509  stdx::optional<std::int64_t> _limit;
510  stdx::optional<bsoncxx::document::view_or_value> _max;
511  stdx::optional<std::chrono::milliseconds> _max_await_time;
512  stdx::optional<std::chrono::milliseconds> _max_time;
513  stdx::optional<bsoncxx::document::view_or_value> _min;
514  stdx::optional<bool> _no_cursor_timeout;
515  stdx::optional<bsoncxx::document::view_or_value> _projection;
516  stdx::optional<class read_preference> _read_preference;
517  stdx::optional<bool> _return_key;
518  stdx::optional<bool> _show_record_id;
519  stdx::optional<std::int64_t> _skip;
520  stdx::optional<bsoncxx::document::view_or_value> _ordering;
521 };
522 
523 } // namespace options
524 MONGOCXX_INLINE_NAMESPACE_END
525 } // namespace mongocxx
526 
527 #include <mongocxx/config/postlude.hpp>
mongocxx
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
bsoncxx::view_or_value< document::view, document::value >
mongocxx::read_preference
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:62
bsoncxx::string::view_or_value
Class representing a view-or-value variant type for strings.
Definition: view_or_value.hpp:36
mongocxx::options::find
Class representing the optional arguments to a MongoDB query.
Definition: find.hpp:36
mongocxx::hint
Class representing a hint to be passed to a database operation.
Definition: hint.hpp:32