MongoDB C++ Driver current
Loading...
Searching...
No Matches
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
137 MONGOCXX_ABI_EXPORT_CDECL(find&) collation(bsoncxx::v_noabi::document::view_or_value collation);
138
148 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> const&)
149 collation() const;
150
167 MONGOCXX_ABI_EXPORT_CDECL(find&) comment(bsoncxx::v_noabi::string::view_or_value comment);
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
234 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::hint> const&)
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
293 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<
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
509 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::read_preference> const&)
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
The index to "hint" or force a MongoDB server to use when performing a query.
Definition hint.hpp:35
Used by MongoDB find operations.
Definition find.hpp:40
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & collation() const
Retrieves the current collation for this operation.
bsoncxx::v_noabi::stdx::optional< cursor::type > const & cursor_type() const
Gets the current cursor type.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & min() const
Sets the current inclusive lower bound for a specific index.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & sort() const
Gets the current sort ordering for this query.
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...
bsoncxx::v_noabi::stdx::optional< bool > const & allow_partial_results() const
Gets the current setting for allowing partial results from mongos.
bsoncxx::v_noabi::stdx::optional< std::int64_t > const & limit() const
Gets the current limit.
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...
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const let() const
Gets the current value of the let option.
bsoncxx::v_noabi::stdx::optional< bool > const & show_record_id() const
Gets the current setting for whether the record identifier is returned for each document in the query...
bsoncxx::v_noabi::stdx::optional< std::int32_t > const & batch_size() const
The current batch size setting.
bsoncxx::v_noabi::stdx::optional< bool > const & allow_disk_use() const
Gets the current setting for allowing disk use on the server.
bsoncxx::v_noabi::stdx::optional< bool > const & no_cursor_timeout() const
Gets the current no_cursor_timeout setting.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > const & comment_option() const
Gets the current value of the comment option.
bsoncxx::v_noabi::stdx::optional< std::int64_t > const & skip() const
Gets the current number of documents to skip.
bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > const & max_await_time() const
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query...
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & max() const
Sets the current exclusive upper bound for a specific index.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::string::view_or_value > const & comment() const
Gets the current comment attached to this query.
bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > const & max_time() const
The current max_time_ms setting.
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > const & projection() const
Gets the current projection set on this query.
bsoncxx::v_noabi::stdx::optional< bool > const & return_key() const
Gets the current setting for returning the index keys associated with the query results,...
Describes how MongoDB clients route read operations to the members of a replica set or sharded cluste...
Definition read_preference.hpp:49
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.
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.