MongoDB C++ Driver mongocxx-4.0.0
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(const bsoncxx::v_noabi::stdx::optional<std::int32_t>&)
122 batch_size() const;
123
137 MONGOCXX_ABI_EXPORT_CDECL(find&) collation(bsoncxx::v_noabi::document::view_or_value collation);
138
149 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
150 collation() const;
151
168 MONGOCXX_ABI_EXPORT_CDECL(find&) comment(bsoncxx::v_noabi::string::view_or_value comment);
169
181 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::string::view_or_value>&)
182 comment() const;
183
198
207 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<cursor::type>&)
208 cursor_type() const;
209
227
236 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::hint>&)
237 hint() const;
238
252 MONGOCXX_ABI_EXPORT_CDECL(find&) let(bsoncxx::v_noabi::document::view_or_value let);
253
264 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value>)
265 let() const;
266
283 comment_option(bsoncxx::v_noabi::types::bson_value::view_or_value comment);
284
297 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>&)
299
313
322 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<std::int64_t>&) limit() const;
323
337 MONGOCXX_ABI_EXPORT_CDECL(find&) max(bsoncxx::v_noabi::document::view_or_value max);
338
348 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
349 max() const;
350
370
380 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds>&)
382
397
406 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds>&)
407 max_time() const;
408
422 MONGOCXX_ABI_EXPORT_CDECL(find&) min(bsoncxx::v_noabi::document::view_or_value min);
423
433 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
434 min() const;
435
451
460 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<bool>&)
462
477 projection(bsoncxx::v_noabi::document::view_or_value projection);
478
488 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
489 projection() const;
490
505
516 const bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::read_preference>&)
518
535
547 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<bool>&) return_key() const;
548
563
574 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<bool>&) show_record_id() const;
575
590
599 MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional<std::int64_t>&) skip() const;
600
615 MONGOCXX_ABI_EXPORT_CDECL(find&) sort(bsoncxx::v_noabi::document::view_or_value ordering);
616
626 const bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
627 sort() const;
628
629 private:
630 bsoncxx::v_noabi::stdx::optional<bool> _allow_disk_use;
631 bsoncxx::v_noabi::stdx::optional<bool> _allow_partial_results;
632 bsoncxx::v_noabi::stdx::optional<std::int32_t> _batch_size;
633 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
634 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::string::view_or_value> _comment;
635 bsoncxx::v_noabi::stdx::optional<cursor::type> _cursor_type;
636 bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::hint> _hint;
637 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _let;
638 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>
639 _comment_option;
640 bsoncxx::v_noabi::stdx::optional<std::int64_t> _limit;
641 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _max;
642 bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> _max_await_time;
643 bsoncxx::v_noabi::stdx::optional<std::chrono::milliseconds> _max_time;
644 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _min;
645 bsoncxx::v_noabi::stdx::optional<bool> _no_cursor_timeout;
646 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _projection;
647 bsoncxx::v_noabi::stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
648 bsoncxx::v_noabi::stdx::optional<bool> _return_key;
649 bsoncxx::v_noabi::stdx::optional<bool> _show_record_id;
650 bsoncxx::v_noabi::stdx::optional<std::int64_t> _skip;
651 bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::document::view_or_value> _ordering;
652};
653
654} // namespace options
655} // namespace v_noabi
656} // namespace mongocxx
657
658#include <mongocxx/config/postlude.hpp>
659
A polyfill for std::optional<T>.
Definition optional.hpp:826
Class representing a pointer to the result set of a query on a MongoDB server.
Definition cursor.hpp:42
Class representing a hint to be passed to a database operation.
Definition hint.hpp:35
Class representing the optional arguments to a MongoDB query.
Definition find.hpp:40
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > let() const
Gets the current value of the let option.
const bsoncxx::v_noabi::stdx::optional< cursor::type > & cursor_type() const
Gets the current cursor type.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & comment_option() const
Gets the current value of the comment option.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & min() const
Sets the current inclusive lower bound for a specific index.
const bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time_ms setting.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::string::view_or_value > & comment() const
Gets the current comment attached to 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...
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...
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & projection() const
Gets the current projection set on this query.
const bsoncxx::v_noabi::stdx::optional< bool > & allow_disk_use() const
Gets the current setting for allowing disk use on the server.
const bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > & max_await_time() const
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query...
const bsoncxx::v_noabi::stdx::optional< bool > & return_key() const
Gets the current setting for returning the index keys associated with the query results,...
const bsoncxx::v_noabi::stdx::optional< bool > & allow_partial_results() const
Gets the current setting for allowing partial results from mongos.
const bsoncxx::v_noabi::stdx::optional< bool > & show_record_id() const
Gets the current setting for whether the record identifier is returned for each document in the query...
const bsoncxx::v_noabi::stdx::optional< std::int64_t > & skip() const
Gets the current number of documents to skip.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & max() const
Sets the current exclusive upper bound for a specific index.
const bsoncxx::v_noabi::stdx::optional< std::int64_t > & limit() const
Gets the current limit.
const bsoncxx::v_noabi::stdx::optional< std::int32_t > & batch_size() const
The current batch size setting.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation() const
Retrieves the current collation for this operation.
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & sort() const
Gets the current sort ordering for this query.
const bsoncxx::v_noabi::stdx::optional< bool > & no_cursor_timeout() const
Gets the current no_cursor_timeout setting.
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition read_preference.hpp:64
Provides mongocxx::v_noabi::cursor.
Provides bsoncxx::v_noabi::document::view_or_value.
Declares mongocxx::v_noabi::options::find.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:204
Provides mongocxx::v_noabi::hint.
The mongocxx 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.
The top-level namespace reserved for the C++ standard library.
Provides std::optional-related polyfills for library API usage.
Provides mongocxx::v_noabi::read_preference.
Provides bsoncxx::v_noabi::string::view_or_value.
Provides bsoncxx::v_noabi::types::bson_value::view_or_value.