MongoDB C++ Driver mongocxx-3.11.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
96
111
121
136
147 collation() const;
148
165 MONGOCXX_ABI_EXPORT_CDECL(find&) comment(bsoncxx::v_noabi::string::view_or_value comment);
166
177 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::string::view_or_value>&)
178 comment() const;
179
194
203 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<cursor::type>&) cursor_type() const;
204
222
231 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<mongocxx::v_noabi::hint>&) hint() const;
232
246 MONGOCXX_ABI_EXPORT_CDECL(find&) let(bsoncxx::v_noabi::document::view_or_value let);
247
257 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view_or_value>)
258 let() const;
259
276 comment_option(bsoncxx::v_noabi::types::bson_value::view_or_value comment);
277
290 const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>&)
292
306
315 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::int64_t>&) limit() const;
316
330 MONGOCXX_ABI_EXPORT_CDECL(find&) max(bsoncxx::v_noabi::document::view_or_value max);
331
340 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
341 max() const;
342
362
372 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::chrono::milliseconds>&)
374
389
398 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::chrono::milliseconds>&) max_time() const;
399
413 MONGOCXX_ABI_EXPORT_CDECL(find&) min(bsoncxx::v_noabi::document::view_or_value min);
414
423 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
424 min() const;
425
441
450 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) no_cursor_timeout() const;
451
466 projection(bsoncxx::v_noabi::document::view_or_value projection);
467
476 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
477 projection() const;
478
493
503 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<mongocxx::v_noabi::read_preference>&)
505
522
534 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) return_key() const;
535
550
561 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bool>&) show_record_id() const;
562
577
586 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<std::int64_t>&) skip() const;
587
602 MONGOCXX_ABI_EXPORT_CDECL(find&) sort(bsoncxx::v_noabi::document::view_or_value ordering);
603
612 MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional<bsoncxx::v_noabi::document::view_or_value>&)
613 sort() const;
614
615 private:
616 stdx::optional<bool> _allow_disk_use;
617 stdx::optional<bool> _allow_partial_results;
618 stdx::optional<std::int32_t> _batch_size;
619 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
620 stdx::optional<bsoncxx::v_noabi::string::view_or_value> _comment;
621 stdx::optional<cursor::type> _cursor_type;
622 stdx::optional<mongocxx::v_noabi::hint> _hint;
623 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _let;
624 stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _comment_option;
625 stdx::optional<std::int64_t> _limit;
626 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _max;
627 stdx::optional<std::chrono::milliseconds> _max_await_time;
628 stdx::optional<std::chrono::milliseconds> _max_time;
629 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _min;
630 stdx::optional<bool> _no_cursor_timeout;
631 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _projection;
632 stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
633 stdx::optional<bool> _return_key;
634 stdx::optional<bool> _show_record_id;
635 stdx::optional<std::int64_t> _skip;
636 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _ordering;
637};
638
639} // namespace options
640} // namespace v_noabi
641} // namespace mongocxx
642
643#include <mongocxx/config/postlude.hpp>
644
A polyfill for std::optional<T>.
Definition optional.hpp:874
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:37
Class representing the optional arguments to a MongoDB query.
Definition find.hpp:40
const stdx::optional< std::int32_t > & batch_size() const
The current batch size setting.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & min() const
Sets the current inclusive lower bound for a specific index.
const stdx::optional< bool > & show_record_id() const
Gets the current setting for whether the record identifier is returned for each document in the 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...
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & projection() const
Gets the current projection set on this query.
const stdx::optional< std::chrono::milliseconds > & max_time() const
The current max_time_ms setting.
const stdx::optional< bool > & allow_partial_results() const
Gets the current setting for allowing partial results from mongos.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation() const
Retrieves the current collation for this operation.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > let() const
Gets the current value of the let option.
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 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 stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & comment_option() const
Gets the current value of the comment option.
const stdx::optional< bool > & allow_disk_use() const
Gets the current setting for allowing disk use on the server.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & max() const
Sets the current exclusive upper bound for a specific index.
const stdx::optional< std::int64_t > & limit() const
Gets the current limit.
const stdx::optional< cursor::type > & cursor_type() const
Gets the current cursor type.
const stdx::optional< bool > & no_cursor_timeout() const
Gets the current no_cursor_timeout setting.
const stdx::optional< std::int64_t > & skip() const
Gets the current number of documents to skip.
const stdx::optional< bool > & return_key() const
Gets the current setting for returning the index keys associated with the query results,...
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & comment() const
Gets the current comment attached to this query.
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.
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & sort() const
Gets the current sort ordering for this query.
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition read_preference.hpp:65
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:222
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.