MongoDB C++ Driver
mongocxx-3.1.0
|
Class representing the optional arguments to a MongoDB query. More...
#include <find.hpp>
Public Member Functions | |
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). More... | |
const stdx::optional< bool > & | allow_partial_results () const |
Gets the current setting for allowing partial results from mongos. More... | |
find & | batch_size (std::int32_t batch_size) |
Sets the number of documents to return per batch. More... | |
const stdx::optional< std::int32_t > & | batch_size () const |
The current batch size setting. More... | |
find & | collation (bsoncxx::document::view_or_value collation) |
Sets the collation for this operation. More... | |
const stdx::optional< bsoncxx::document::view_or_value > & | collation () const |
Retrieves the current collation for this operation. More... | |
find & | comment (bsoncxx::string::view_or_value comment) |
Attaches a comment to the query. More... | |
const stdx::optional< bsoncxx::string::view_or_value > & | comment () const |
Gets the current comment attached to this query. More... | |
find & | cursor_type (cursor::type cursor_type) |
Indicates the type of cursor to use for this query. More... | |
const stdx::optional< cursor::type > & | cursor_type () const |
Gets the current cursor type. More... | |
find & | hint (class hint index_hint) |
Sets the index to use for this operation. More... | |
const stdx::optional< class hint > & | hint () const |
Gets the current hint. More... | |
find & | limit (std::int32_t limit) |
Sets maximum number of documents to return. More... | |
const stdx::optional< std::int32_t > & | limit () const |
Gets the current limit. More... | |
find & | max (bsoncxx::document::view_or_value max) |
Gets the current exclusive upper bound for a specific index. More... | |
const stdx::optional< bsoncxx::document::view_or_value > & | max () const |
Sets the current exclusive upper bound for a specific index. More... | |
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. More... | |
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. More... | |
find & | max_scan (std::int32_t max) |
Sets the maximum number of documents or index keys to scan when executing the query. More... | |
const stdx::optional< std::int32_t > & | max_scan () const |
Gets the current setting for the maximum number of documents to scan when executing the query. More... | |
find & | max_time (std::chrono::milliseconds max_time) |
Sets the maximum amount of time for this operation to run (server-side) in milliseconds. More... | |
const stdx::optional< std::chrono::milliseconds > & | max_time () const |
The current max_time_ms setting. More... | |
find & | min (bsoncxx::document::view_or_value min) |
Gets the current inclusive lower bound for a specific index. More... | |
const stdx::optional< bsoncxx::document::view_or_value > & | min () const |
Sets the current inclusive lower bound for a specific index. More... | |
find & | modifiers (bsoncxx::document::view_or_value modifiers) |
Sets the meta-operators modifying the output or behavior of the query. More... | |
const stdx::optional< bsoncxx::document::view_or_value > & | modifiers () const |
Gets the current query modifiers. More... | |
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. More... | |
const stdx::optional< bool > & | no_cursor_timeout () const |
Gets the current no_cursor_timeout setting. More... | |
find & | projection (bsoncxx::document::view_or_value projection) |
Sets a projection which limits the returned fields for all matching documents. More... | |
const stdx::optional< bsoncxx::document::view_or_value > & | projection () const |
Gets the current projection set on this query. More... | |
find & | read_preference (class read_preference rp) |
Sets the read_preference for this operation. More... | |
const stdx::optional< class read_preference > & | read_preference () const |
The current read_preference for this operation. More... | |
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. More... | |
const 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. More... | |
find & | show_record_id (bool show_record_id) |
Sets whether to include the record identifier for each document in the query results. More... | |
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 results. More... | |
find & | skip (std::int32_t skip) |
Sets the number of documents to skip before returning results. More... | |
const stdx::optional< std::int32_t > & | skip () const |
Gets the current number of documents to skip. More... | |
find & | snapshot (bool snapshot) |
Sets whether snapshot mode should be used. More... | |
const stdx::optional< bool > & | snapshot () const |
Gets the current setting for whether snapshot mode is being used. More... | |
find & | sort (bsoncxx::document::view_or_value ordering) |
The order in which to return matching documents. More... | |
const stdx::optional< bsoncxx::document::view_or_value > & | sort () const |
Gets the current sort ordering for this query. More... | |
MONGOCXX_PRIVATE find & | modifiers_clear () |
Clears the modifiers member. More... | |
Class representing the optional arguments to a MongoDB query.
find& mongocxx::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 stdx::optional<bool>& mongocxx::options::find::allow_partial_results | ( | ) | const |
Gets the current setting for allowing partial results from mongos.
find& mongocxx::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 stdx::optional<std::int32_t>& mongocxx::options::find::batch_size | ( | ) | const |
The current batch size setting.
find& mongocxx::options::find::collation | ( | bsoncxx::document::view_or_value | collation | ) |
Sets the collation for this operation.
collation | The new collation. |
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::find::collation | ( | ) | const |
Retrieves the current collation for this operation.
find& mongocxx::options::find::comment | ( | bsoncxx::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 stdx::optional<bsoncxx::string::view_or_value>& mongocxx::options::find::comment | ( | ) | const |
Gets the current comment attached to this query.
find& mongocxx::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 stdx::optional<cursor::type>& mongocxx::options::find::cursor_type | ( | ) | const |
Gets the current cursor type.
Sets the index to use for this operation.
index_hint | Object representing the index to use. |
const stdx::optional<class hint>& mongocxx::options::find::hint | ( | ) | const |
Gets the current hint.
find& mongocxx::options::find::limit | ( | std::int32_t | limit | ) |
Sets maximum number of documents to return.
limit | The maximum number of documents to return. |
const stdx::optional<std::int32_t>& mongocxx::options::find::limit | ( | ) | const |
Gets the current limit.
find& mongocxx::options::find::max | ( | bsoncxx::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 stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::find::max | ( | ) | const |
Sets the current exclusive upper bound for a specific index.
find& mongocxx::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 stdx::optional<std::chrono::milliseconds>& mongocxx::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::options::find::max_scan | ( | std::int32_t | max | ) |
Sets the maximum number of documents or index keys to scan when executing the query.
max | The maximum number of documents or index keys to scan. |
const stdx::optional<std::int32_t>& mongocxx::options::find::max_scan | ( | ) | const |
Gets the current setting for the maximum number of documents to scan when executing the query.
find& mongocxx::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 stdx::optional<std::chrono::milliseconds>& mongocxx::options::find::max_time | ( | ) | const |
The current max_time_ms setting.
find& mongocxx::options::find::min | ( | bsoncxx::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 stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::find::min | ( | ) | const |
Sets the current inclusive lower bound for a specific index.
find& mongocxx::options::find::modifiers | ( | bsoncxx::document::view_or_value | modifiers | ) |
Sets the meta-operators modifying the output or behavior of the query.
modifiers | The query modifiers. |
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::find::modifiers | ( | ) | const |
Gets the current query modifiers.
MONGOCXX_PRIVATE find& mongocxx::options::find::modifiers_clear | ( | ) |
Clears the modifiers member.
Internal-only.
find& mongocxx::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 stdx::optional<bool>& mongocxx::options::find::no_cursor_timeout | ( | ) | const |
Gets the current no_cursor_timeout setting.
find& mongocxx::options::find::projection | ( | bsoncxx::document::view_or_value | projection | ) |
Sets a projection which limits the returned fields for all matching documents.
projection | The projection document. |
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::find::projection | ( | ) | const |
Gets the current projection set on this query.
find& mongocxx::options::find::read_preference | ( | class read_preference | rp | ) |
Sets the read_preference for this operation.
rp | The new read_preference. |
const stdx::optional<class read_preference>& mongocxx::options::find::read_preference | ( | ) | const |
The current read_preference for this operation.
find& mongocxx::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 stdx::optional<bool>& mongocxx::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::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 stdx::optional<bool>& mongocxx::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::options::find::skip | ( | std::int32_t | skip | ) |
Sets the number of documents to skip before returning results.
skip | The number of documents to skip. |
const stdx::optional<std::int32_t>& mongocxx::options::find::skip | ( | ) | const |
Gets the current number of documents to skip.
find& mongocxx::options::find::snapshot | ( | bool | snapshot | ) |
Sets whether snapshot mode should be used.
snapshot | Whether to enable snapshot mode. |
const stdx::optional<bool>& mongocxx::options::find::snapshot | ( | ) | const |
Gets the current setting for whether snapshot mode is being used.
find& mongocxx::options::find::sort | ( | bsoncxx::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. |
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::options::find::sort | ( | ) | const |
Gets the current sort ordering for this query.