MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
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 <mongocxx/options/find-fwd.hpp>
21
22#include <bsoncxx/document/view_or_value.hpp>
23#include <bsoncxx/stdx/optional.hpp>
24#include <bsoncxx/string/view_or_value.hpp>
25#include <bsoncxx/types/bson_value/view_or_value.hpp>
26#include <mongocxx/cursor.hpp>
27#include <mongocxx/hint.hpp>
28#include <mongocxx/read_preference.hpp>
29
30#include <mongocxx/config/prelude.hpp>
31
32namespace mongocxx {
33namespace v_noabi {
34namespace options {
35
39class find {
40 public:
59
67 const stdx::optional<bool>& allow_disk_use() const;
68
82 find& allow_partial_results(bool allow_partial);
83
91 const stdx::optional<bool>& allow_partial_results() const;
92
105 find& batch_size(std::int32_t batch_size);
106
114 const stdx::optional<std::int32_t>& batch_size() const;
115
129
138 const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& collation() const;
139
156
166 const stdx::optional<bsoncxx::v_noabi::string::view_or_value>& comment() const;
167
181
189 const stdx::optional<cursor::type>& cursor_type() const;
190
207
215 const stdx::optional<mongocxx::v_noabi::hint>& hint() const;
216
230
239 const stdx::optional<bsoncxx::v_noabi::document::view_or_value> let() const;
240
256
267 const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& comment_option()
268 const;
269
281 find& limit(std::int64_t limit);
282
290 const stdx::optional<std::int64_t>& limit() const;
291
305
313 const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& max() const;
314
332 find& max_await_time(std::chrono::milliseconds max_await_time);
333
342 const stdx::optional<std::chrono::milliseconds>& max_await_time() const;
343
356 find& max_time(std::chrono::milliseconds max_time);
357
365 const stdx::optional<std::chrono::milliseconds>& max_time() const;
366
380
388 const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& min() const;
389
404
412 const stdx::optional<bool>& no_cursor_timeout() const;
413
427
435 const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& projection() const;
436
450
459 const stdx::optional<mongocxx::v_noabi::read_preference>& read_preference() const;
460
476
487 const stdx::optional<bool>& return_key() const;
488
502
512 const stdx::optional<bool>& show_record_id() const;
513
526 find& skip(std::int64_t skip);
527
535 const stdx::optional<std::int64_t>& skip() const;
536
551
559 const stdx::optional<bsoncxx::v_noabi::document::view_or_value>& sort() const;
560
561 private:
562 stdx::optional<bool> _allow_disk_use;
563 stdx::optional<bool> _allow_partial_results;
564 stdx::optional<std::int32_t> _batch_size;
565 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _collation;
566 stdx::optional<bsoncxx::v_noabi::string::view_or_value> _comment;
567 stdx::optional<cursor::type> _cursor_type;
568 stdx::optional<mongocxx::v_noabi::hint> _hint;
569 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _let;
570 stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _comment_option;
571 stdx::optional<std::int64_t> _limit;
572 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _max;
573 stdx::optional<std::chrono::milliseconds> _max_await_time;
574 stdx::optional<std::chrono::milliseconds> _max_time;
575 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _min;
576 stdx::optional<bool> _no_cursor_timeout;
577 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _projection;
578 stdx::optional<mongocxx::v_noabi::read_preference> _read_preference;
579 stdx::optional<bool> _return_key;
580 stdx::optional<bool> _show_record_id;
581 stdx::optional<std::int64_t> _skip;
582 stdx::optional<bsoncxx::v_noabi::document::view_or_value> _ordering;
583};
584
585} // namespace options
586} // namespace v_noabi
587} // namespace mongocxx
588
589#include <mongocxx/config/postlude.hpp>
Class representing a view-or-value variant type for strings.
Definition view_or_value.hpp:38
Class representing a hint to be passed to a database operation.
Definition hint.hpp:34
Class representing the optional arguments to a MongoDB query.
Definition find.hpp:39
const stdx::optional< std::int32_t > & batch_size() const
The current batch size setting.
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.
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 ...
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & min() const
Sets the current inclusive lower bound for a specific index.
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.
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 & 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...
const stdx::optional< mongocxx::v_noabi::read_preference > & read_preference() const
The current read_preference for this operation.
const stdx::optional< mongocxx::v_noabi::hint > & hint() const
Gets the current hint.
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.
find & limit(std::int64_t limit)
Sets maximum number of documents to return.
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...
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.
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.
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.
find & projection(bsoncxx::v_noabi::document::view_or_value projection)
Sets a projection which limits the returned fields for all matching documents.
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 & 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.
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:63
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19