MongoDB C++ Driver 4.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
find.hpp
Go to the documentation of this file.
1// Copyright 2009-present 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
21
26
27#include <mongocxx/cursor.hpp>
28#include <mongocxx/hint.hpp>
30
32
33namespace mongocxx {
34namespace v_noabi {
35namespace options {
36
40class find {
41 public:
61
70
86
97
112
121 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::int32_t> const&)
122 batch_size() const;
123
138
148 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const&)
149 collation() const;
150
168
179 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::string::view_or_value> const&)
180 comment() const;
181
196
205 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<cursor::type> const&)
206 cursor_type() const;
207
225
235 hint() const;
236
250 MONGOCXX_ABI_EXPORT_CDECL(find&) let(bsoncxx::v_noabi::document::view_or_value let);
251
261 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const)
262 let() const;
263
280 comment_option(bsoncxx::v_noabi::types::bson_value::view_or_value comment);
281
294 bsoncxx::v_noabi::types::bson_value::view_or_value> const&)
296
310
319 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::int64_t> const&) limit() const;
320
334 MONGOCXX_ABI_EXPORT_CDECL(find&) max(bsoncxx::v_noabi::document::view_or_value max);
335
344 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const&)
345 max() const;
346
366
376 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> const&)
378
392 MONGOCXX_ABI_EXPORT_CDECL(find&) max_time(std::chrono::milliseconds max_time);
393
402 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> const&)
403 max_time() const;
404
418 MONGOCXX_ABI_EXPORT_CDECL(find&) min(bsoncxx::v_noabi::document::view_or_value min);
419
428 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const&)
429 min() const;
430
446
455 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bool> const&)
457
472 projection(bsoncxx::v_noabi::document::view_or_value projection);
473
482 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const&)
483 projection() const;
484
499
511
528
540 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bool> const&) return_key() const;
541
556
567 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bool> const&) show_record_id() const;
568
583
592 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::int64_t> const&) skip() const;
593
608 MONGOCXX_ABI_EXPORT_CDECL(find&) sort(bsoncxx::v_noabi::document::view_or_value ordering);
609
618 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const&)
619 sort() const;
620
621 private:
622 bsoncxx::v_noabi::stdx::optional<bool> _allow_disk_use;
623 bsoncxx::v_noabi::stdx::optional<bool> _allow_partial_results;
624 bsoncxx::v_noabi::stdx::optional<std::int32_t> _batch_size;
625 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
626 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::string::view_or_value> _comment;
627 bsoncxx::v_noabi::stdx::optional<cursor::type> _cursor_type;
628 bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::hint> _hint;
629 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _let;
630 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _comment_option;
631 bsoncxx::v_noabi::stdx::optional<std::int64_t> _limit;
632 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _max;
633 bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> _max_await_time;
634 bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> _max_time;
635 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _min;
636 bsoncxx::v_noabi::stdx::optional<bool> _no_cursor_timeout;
637 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _projection;
638 bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
639 bsoncxx::v_noabi::stdx::optional<bool> _return_key;
640 bsoncxx::v_noabi::stdx::optional<bool> _show_record_id;
641 bsoncxx::v_noabi::stdx::optional<std::int64_t> _skip;
642 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _ordering;
643};
644
645} // namespace options
646} // namespace v_noabi
647} // namespace mongocxx
648
649#include <mongocxx/config/postlude.hpp>
650
A polyfill for std::optional<T>.
Definition optional.hpp:800
A cursor over the documents returned by a query to a MongoDB server.
Definition cursor.hpp:42
Used by MongoDB find operations.
Definition find.hpp:40
find & read_preference(mongocxx::v_noabi::read_preference rp)
Sets the read_preference for this operation.
find & sort(bsoncxx::v_noabi::document::view_or_value ordering)
The order in which to return matching documents. If $orderby also exists in the modifiers document,...
find & let(bsoncxx::v_noabi::document::view_or_value let)
Set the value of the let option.
find & max_await_time(std::chrono::milliseconds max_await_time)
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query...
find & return_key(bool return_key)
Sets whether to return the index keys associated with the query results, instead of the actual query ...
find & comment_option(bsoncxx::v_noabi::types::bson_value::view_or_value comment)
Set the value of the comment option.
find & no_cursor_timeout(bool no_cursor_timeout)
Sets the cursor flag to prevent cursor from timing out server-side due to a period of inactivity.
find & hint(mongocxx::v_noabi::hint index_hint)
Sets the index to use for this operation.
find & allow_partial_results(bool allow_partial)
Sets whether to allow partial results from a mongos if some shards are down (instead of throwing an e...
find & allow_disk_use(bool allow_disk_use)
Enables writing to temporary files on the server. When set to true, the server can write temporary da...
find & limit(std::int64_t limit)
Sets maximum number of documents to return.
find & max_time(std::chrono::milliseconds max_time)
Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
find & cursor_type(cursor::type cursor_type)
Indicates the type of cursor to use for this query.
find & show_record_id(bool show_record_id)
Sets whether to include the record identifier for each document in the query results.
find & min(bsoncxx::v_noabi::document::view_or_value min)
Gets the current inclusive lower bound for a specific index.
bsoncxx::v_noabi::stdx::optional< bool > const & allow_disk_use() const
Gets the current setting for allowing disk use on the server.
find & skip(std::int64_t skip)
Sets the number of documents to skip before returning results.
find & comment(bsoncxx::v_noabi::string::view_or_value comment)
Attaches a comment to the query. If $comment also exists in the modifiers document then the comment f...
find & projection(bsoncxx::v_noabi::document::view_or_value projection)
Sets a projection which limits the returned fields for all matching documents.
find & max(bsoncxx::v_noabi::document::view_or_value max)
Gets the current exclusive upper bound for a specific index.
find & batch_size(std::int32_t batch_size)
Sets the number of documents to return per batch.
find & collation(bsoncxx::v_noabi::document::view_or_value collation)
Sets the collation for this operation.
Provides mongocxx::v_noabi::cursor.
Provides bsoncxx::v_noabi::document::view_or_value.
Declares mongocxx::v_noabi::options::find.
Provides mongocxx::v_noabi::hint.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities representing options to use with various commands.
Declares entities whose ABI stability is NOT guaranteed.
The top-level namespace within which all mongocxx library entities are declared.
Provides mongocxx::v_noabi::read_preference.
Provides bsoncxx::v_noabi::string::view_or_value.
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.
Provides std::optional-related polyfills for library API usage.