MongoDB C++ Driver mongocxx-4.0.0
|
#include <mongocxx/v_noabi/mongocxx/options/find.hpp>
Class representing the optional arguments to a MongoDB query.
Public Member Functions | |
const bsoncxx::v_noabi::stdx::optional< bool > & | allow_disk_use () const |
Gets the current setting for allowing disk use on the server. | |
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 data to disk while executing the find operation. | |
const bsoncxx::v_noabi::stdx::optional< bool > & | allow_partial_results () const |
Gets the current setting for allowing partial results from mongos. | |
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 error). | |
const bsoncxx::v_noabi::stdx::optional< std::int32_t > & | batch_size () const |
The current batch size setting. | |
find & | batch_size (std::int32_t batch_size) |
Sets the number of documents to return per batch. | |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & | collation () const |
Retrieves the current collation for this operation. | |
find & | collation (bsoncxx::v_noabi::document::view_or_value collation) |
Sets the collation for this operation. | |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::string::view_or_value > & | comment () const |
Gets the current comment attached to this query. | |
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 field overwrites $comment. | |
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. | |
find & | comment_option (bsoncxx::v_noabi::types::bson_value::view_or_value comment) |
Set the value of the comment option. | |
const bsoncxx::v_noabi::stdx::optional< cursor::type > & | cursor_type () const |
Gets the current cursor type. | |
find & | cursor_type (cursor::type cursor_type) |
Indicates the type of cursor to use for this query. | |
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::hint > & | hint () const |
Gets the current hint. | |
find & | hint (mongocxx::v_noabi::hint index_hint) |
Sets the index to use for this operation. | |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > | let () const |
Gets the current value of the let option. | |
find & | let (bsoncxx::v_noabi::document::view_or_value let) |
Set the value of the let option. | |
const bsoncxx::v_noabi::stdx::optional< std::int64_t > & | limit () const |
Gets the current limit. | |
find & | limit (std::int64_t limit) |
Sets maximum number of documents to return. | |
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. | |
find & | max (bsoncxx::v_noabi::document::view_or_value max) |
Gets the current exclusive upper bound for a specific index. | |
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. | |
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. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored. The default on the server is to wait for one second. | |
const bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > & | max_time () const |
The current max_time_ms setting. | |
find & | max_time (std::chrono::milliseconds max_time) |
Sets the maximum amount of time for this operation to run (server-side) in milliseconds. | |
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. | |
find & | min (bsoncxx::v_noabi::document::view_or_value min) |
Gets the current inclusive lower bound for a specific index. | |
const bsoncxx::v_noabi::stdx::optional< bool > & | no_cursor_timeout () const |
Gets the current no_cursor_timeout setting. | |
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 bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & | projection () const |
Gets the current projection set on this query. | |
find & | projection (bsoncxx::v_noabi::document::view_or_value projection) |
Sets a projection which limits the returned fields for all matching documents. | |
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::read_preference > & | read_preference () const |
The current read_preference for this operation. | |
find & | read_preference (mongocxx::v_noabi::read_preference rp) |
Sets the read_preference for this operation. | |
const bsoncxx::v_noabi::stdx::optional< bool > & | return_key () const |
Gets the current setting for returning the index keys associated with the query results, instead of the actual query results themselves. | |
find & | return_key (bool return_key) |
Sets whether to return the index keys associated with the query results, instead of the actual query results themselves. | |
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 results. | |
find & | show_record_id (bool show_record_id) |
Sets whether to include the record identifier for each document in the query results. | |
const bsoncxx::v_noabi::stdx::optional< std::int64_t > & | skip () const |
Gets the current number of documents to skip. | |
find & | skip (std::int64_t skip) |
Sets the number of documents to skip before returning results. | |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & | sort () const |
Gets the current sort ordering for this query. | |
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, the sort field takes precedence over $orderby. | |
const bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::options::find::allow_disk_use | ( | ) | const |
Gets the current setting for allowing disk use on the server.
This option may only be used with MongoDB version 4.4 or later.
find & mongocxx::v_noabi::options::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 data to disk while executing the find operation.
This option is sent only if the caller explicitly provides a value. The default is to not send a value.
This option may only be used with MongoDB version 4.4 or later.
allow_disk_use | Whether to allow writing temporary files on the server. |
const bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::options::find::allow_partial_results | ( | ) | const |
Gets the current setting for allowing partial results from mongos.
find & mongocxx::v_noabi::options::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 error).
allow_partial | Whether to allow partial results from mongos. |
const bsoncxx::v_noabi::stdx::optional< std::int32_t > & mongocxx::v_noabi::options::find::batch_size | ( | ) | const |
The current batch size setting.
find & mongocxx::v_noabi::options::find::batch_size | ( | std::int32_t | batch_size | ) |
Sets the number of documents to return per batch.
batch_size | The size of the batches to request. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::collation | ( | ) | const |
Retrieves the current collation for this operation.
find & mongocxx::v_noabi::options::find::collation | ( | bsoncxx::v_noabi::document::view_or_value | collation | ) |
Sets the collation for this operation.
collation | The new collation. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::string::view_or_value > & mongocxx::v_noabi::options::find::comment | ( | ) | const |
Gets the current comment attached to this query.
find & mongocxx::v_noabi::options::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 field overwrites $comment.
comment | The comment to attach to this query. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & mongocxx::v_noabi::options::find::comment_option | ( | ) | const |
Gets the current value of the comment option.
find & mongocxx::v_noabi::options::find::comment_option | ( | bsoncxx::v_noabi::types::bson_value::view_or_value | comment | ) |
Set the value of the comment option.
comment | The new comment option. |
const bsoncxx::v_noabi::stdx::optional< cursor::type > & mongocxx::v_noabi::options::find::cursor_type | ( | ) | const |
Gets the current cursor type.
find & mongocxx::v_noabi::options::find::cursor_type | ( | cursor::type | cursor_type | ) |
Indicates the type of cursor to use for this query.
cursor_type | The cursor type to set. |
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::hint > & mongocxx::v_noabi::options::find::hint | ( | ) | const |
Gets the current hint.
find & mongocxx::v_noabi::options::find::hint | ( | mongocxx::v_noabi::hint | index_hint | ) |
Sets the index to use for this operation.
index_hint | Object representing the index to use. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > mongocxx::v_noabi::options::find::let | ( | ) | const |
Gets the current value of the let option.
find & mongocxx::v_noabi::options::find::let | ( | bsoncxx::v_noabi::document::view_or_value | let | ) |
Set the value of the let option.
let | The new let option. |
const bsoncxx::v_noabi::stdx::optional< std::int64_t > & mongocxx::v_noabi::options::find::limit | ( | ) | const |
Gets the current limit.
find & mongocxx::v_noabi::options::find::limit | ( | std::int64_t | limit | ) |
Sets maximum number of documents to return.
limit | The maximum number of documents to return. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::max | ( | ) | const |
Sets the current exclusive upper bound for a specific index.
find & mongocxx::v_noabi::options::find::max | ( | bsoncxx::v_noabi::document::view_or_value | max | ) |
Gets the current exclusive upper bound for a specific index.
max | The exclusive upper bound for a specific index. |
const bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > & mongocxx::v_noabi::options::find::max_await_time | ( | ) | const |
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.
find & mongocxx::v_noabi::options::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. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored. The default on the server is to wait for one second.
max_await_time | The max amount of time (in milliseconds) to wait for new documents. |
const bsoncxx::v_noabi::stdx::optional< std::chrono::milliseconds > & mongocxx::v_noabi::options::find::max_time | ( | ) | const |
The current max_time_ms setting.
find & mongocxx::v_noabi::options::find::max_time | ( | std::chrono::milliseconds | max_time | ) |
Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
max_time | The max amount of time (in milliseconds). |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::min | ( | ) | const |
Sets the current inclusive lower bound for a specific index.
find & mongocxx::v_noabi::options::find::min | ( | bsoncxx::v_noabi::document::view_or_value | min | ) |
Gets the current inclusive lower bound for a specific index.
min | The inclusive lower bound for a specific index. |
const bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::options::find::no_cursor_timeout | ( | ) | const |
Gets the current no_cursor_timeout setting.
find & mongocxx::v_noabi::options::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.
no_cursor_timeout | When true prevents the cursor from timing out. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::projection | ( | ) | const |
Gets the current projection set on this query.
find & mongocxx::v_noabi::options::find::projection | ( | bsoncxx::v_noabi::document::view_or_value | projection | ) |
Sets a projection which limits the returned fields for all matching documents.
projection | The projection document. |
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::read_preference > & mongocxx::v_noabi::options::find::read_preference | ( | ) | const |
The current read_preference for this operation.
find & mongocxx::v_noabi::options::find::read_preference | ( | mongocxx::v_noabi::read_preference | rp | ) |
Sets the read_preference for this operation.
rp | The new read_preference. |
const bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::options::find::return_key | ( | ) | const |
Gets the current setting for returning the index keys associated with the query results, instead of the actual query results themselves.
find & mongocxx::v_noabi::options::find::return_key | ( | bool | return_key | ) |
Sets whether to return the index keys associated with the query results, instead of the actual query results themselves.
return_key | Whether to return the index keys associated with the query results, instead of the actual query results themselves. |
const bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::options::find::show_record_id | ( | ) | const |
Gets the current setting for whether the record identifier is returned for each document in the query results.
find & mongocxx::v_noabi::options::find::show_record_id | ( | bool | show_record_id | ) |
Sets whether to include the record identifier for each document in the query results.
show_record_id | Whether to include the record identifier. |
const bsoncxx::v_noabi::stdx::optional< std::int64_t > & mongocxx::v_noabi::options::find::skip | ( | ) | const |
Gets the current number of documents to skip.
find & mongocxx::v_noabi::options::find::skip | ( | std::int64_t | skip | ) |
Sets the number of documents to skip before returning results.
skip | The number of documents to skip. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::sort | ( | ) | const |
Gets the current sort ordering for this query.
find & mongocxx::v_noabi::options::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, the sort field takes precedence over $orderby.
ordering | Document describing the order of the documents to be returned. |