MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
mongocxx::v_noabi::options::find Class Reference

#include <mongocxx/v_noabi/mongocxx/options/find.hpp>

Description

Class representing the optional arguments to a MongoDB query.

Public Member Functions

const stdx::optional< bool > & allow_disk_use () const
 Gets the current setting for allowing disk use on the server.
 
findallow_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 stdx::optional< bool > & allow_partial_results () const
 Gets the current setting for allowing partial results from mongos.
 
findallow_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 stdx::optional< std::int32_t > & batch_size () const
 The current batch size setting.
 
findbatch_size (std::int32_t batch_size)
 Sets the number of documents to return per batch.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation () const
 Retrieves the current collation for this operation.
 
findcollation (bsoncxx::v_noabi::document::view_or_value collation)
 Sets the collation for this operation.
 
const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & comment () const
 Gets the current comment attached to this query.
 
findcomment (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 stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & comment_option () const
 Gets the current value of the comment option.
 
findcomment_option (bsoncxx::v_noabi::types::bson_value::view_or_value comment)
 Set the value of the comment option.
 
const stdx::optional< cursor::type > & cursor_type () const
 Gets the current cursor type.
 
findcursor_type (cursor::type cursor_type)
 Indicates the type of cursor to use for this query.
 
const stdx::optional< mongocxx::v_noabi::hint > & hint () const
 Gets the current hint.
 
findhint (mongocxx::v_noabi::hint index_hint)
 Sets the index to use for this operation.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_valuelet () const
 Gets the current value of the let option.
 
findlet (bsoncxx::v_noabi::document::view_or_value let)
 Set the value of the let option.
 
const stdx::optional< std::int64_t > & limit () const
 Gets the current limit.
 
findlimit (std::int64_t limit)
 Sets maximum number of documents to return.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & max () const
 Sets the current exclusive upper bound for a specific index.
 
findmax (bsoncxx::v_noabi::document::view_or_value max)
 Gets the current exclusive upper bound for a specific index.
 
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.
 
findmax_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 stdx::optional< std::chrono::milliseconds > & max_time () const
 The current max_time_ms setting.
 
findmax_time (std::chrono::milliseconds max_time)
 Sets the maximum amount of time for this operation to run (server-side) in milliseconds.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & min () const
 Sets the current inclusive lower bound for a specific index.
 
findmin (bsoncxx::v_noabi::document::view_or_value min)
 Gets the current inclusive lower bound for a specific index.
 
const stdx::optional< bool > & no_cursor_timeout () const
 Gets the current no_cursor_timeout setting.
 
findno_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< bsoncxx::v_noabi::document::view_or_value > & projection () const
 Gets the current projection set on this query.
 
findprojection (bsoncxx::v_noabi::document::view_or_value projection)
 Sets a projection which limits the returned fields for all matching documents.
 
const stdx::optional< mongocxx::v_noabi::read_preference > & read_preference () const
 The current read_preference for this operation.
 
findread_preference (mongocxx::v_noabi::read_preference rp)
 Sets the read_preference for this operation.
 
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.
 
findreturn_key (bool return_key)
 Sets whether to return the index keys associated with the query results, instead of the actual query results themselves.
 
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.
 
findshow_record_id (bool show_record_id)
 Sets whether to include the record identifier for each document in the query results.
 
const stdx::optional< std::int64_t > & skip () const
 Gets the current number of documents to skip.
 
findskip (std::int64_t skip)
 Sets the number of documents to skip before returning results.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & sort () const
 Gets the current sort ordering for this query.
 
findsort (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.
 

Member Function Documentation

◆ allow_disk_use() [1/2]

const 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.

Returns
Whether disk use on the server is allowed.

◆ allow_disk_use() [2/2]

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.

Parameters
allow_disk_useWhether to allow writing temporary files on the server.
Returns
A reference to this object to facilitate method chaining.
See also

◆ allow_partial_results() [1/2]

const stdx::optional< bool > & mongocxx::v_noabi::options::find::allow_partial_results ( ) const

Gets the current setting for allowing partial results from mongos.

Returns
Whether partial results from mongos are allowed.
See also

◆ allow_partial_results() [2/2]

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).

Parameters
allow_partialWhether to allow partial results from mongos.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ batch_size() [1/2]

const stdx::optional< std::int32_t > & mongocxx::v_noabi::options::find::batch_size ( ) const

The current batch size setting.

Returns
The current batch size.
See also

◆ batch_size() [2/2]

find & mongocxx::v_noabi::options::find::batch_size ( std::int32_t batch_size)

Sets the number of documents to return per batch.

Parameters
batch_sizeThe size of the batches to request.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ collation() [1/2]

const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::collation ( ) const

Retrieves the current collation for this operation.

Returns
The current collation.
See also

◆ collation() [2/2]

find & mongocxx::v_noabi::options::find::collation ( bsoncxx::v_noabi::document::view_or_value collation)

Sets the collation for this operation.

Parameters
collationThe new collation.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ comment() [1/2]

const stdx::optional< bsoncxx::v_noabi::string::view_or_value > & mongocxx::v_noabi::options::find::comment ( ) const

Gets the current comment attached to this query.

Deprecated
use comment_option instead.
Returns
The comment attached to this query.
See also

◆ comment() [2/2]

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.

Deprecated
use comment_option instead.
Parameters
commentThe comment to attach to this query.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ comment_option() [1/2]

const 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.

Note
Not to be confused with the $comment query modifier.
Returns
The current comment option.
See also

◆ comment_option() [2/2]

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.

Note
Not to be confused with the $comment query modifier.
Parameters
commentThe new comment option.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ cursor_type() [1/2]

const stdx::optional< cursor::type > & mongocxx::v_noabi::options::find::cursor_type ( ) const

Gets the current cursor type.

Returns
The current cursor type.
See also

◆ cursor_type() [2/2]

find & mongocxx::v_noabi::options::find::cursor_type ( cursor::type cursor_type)

Indicates the type of cursor to use for this query.

Parameters
cursor_typeThe cursor type to set.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ hint() [1/2]

const stdx::optional< mongocxx::v_noabi::hint > & mongocxx::v_noabi::options::find::hint ( ) const

Gets the current hint.

Returns
The current hint, if one is set.
See also

◆ hint() [2/2]

find & mongocxx::v_noabi::options::find::hint ( mongocxx::v_noabi::hint index_hint)

Sets the index to use for this operation.

See also
Note
if the server already has a cached shape for this query, it may ignore a hint.
Parameters
index_hintObject representing the index to use.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

◆ let() [1/2]

const stdx::optional< bsoncxx::v_noabi::document::view_or_value > mongocxx::v_noabi::options::find::let ( ) const

Gets the current value of the let option.

Returns
The current let option.
See also

◆ let() [2/2]

find & mongocxx::v_noabi::options::find::let ( bsoncxx::v_noabi::document::view_or_value let)

Set the value of the let option.

Parameters
letThe new let option.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ limit() [1/2]

const stdx::optional< std::int64_t > & mongocxx::v_noabi::options::find::limit ( ) const

Gets the current limit.

Returns
The current limit.
See also

◆ limit() [2/2]

find & mongocxx::v_noabi::options::find::limit ( std::int64_t limit)

Sets maximum number of documents to return.

Parameters
limitThe maximum number of documents to return.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ max() [1/2]

const 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.

Returns
The exclusive upper bound for a specific index.
See also

◆ max() [2/2]

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.

Parameters
maxThe exclusive upper bound for a specific index.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ max_await_time() [1/2]

const 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.

Returns
The current max await time (in milliseconds).
See also

◆ max_await_time() [2/2]

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.

Note
On servers < 3.2, this option is ignored.
Parameters
max_await_timeThe max amount of time (in milliseconds) to wait for new documents.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ max_time() [1/2]

const stdx::optional< std::chrono::milliseconds > & mongocxx::v_noabi::options::find::max_time ( ) const

The current max_time_ms setting.

Returns
The current max time (in milliseconds).
See also

◆ max_time() [2/2]

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.

Parameters
max_timeThe max amount of time (in milliseconds).
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ min() [1/2]

const 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.

Returns
The inclusive lower bound for a specific index.
See also

◆ min() [2/2]

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.

Parameters
minThe inclusive lower bound for a specific index.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ no_cursor_timeout() [1/2]

const stdx::optional< bool > & mongocxx::v_noabi::options::find::no_cursor_timeout ( ) const

Gets the current no_cursor_timeout setting.

Returns
The current no_cursor_timeout setting.
See also

◆ no_cursor_timeout() [2/2]

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.

Parameters
no_cursor_timeoutWhen true prevents the cursor from timing out.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ projection() [1/2]

const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::projection ( ) const

Gets the current projection set on this query.

Returns
The current projection.
See also

◆ projection() [2/2]

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.

Parameters
projectionThe projection document.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ read_preference() [1/2]

const stdx::optional< mongocxx::v_noabi::read_preference > & mongocxx::v_noabi::options::find::read_preference ( ) const

The current read_preference for this operation.

Returns
The current read_preference.
See also

◆ read_preference() [2/2]

find & mongocxx::v_noabi::options::find::read_preference ( mongocxx::v_noabi::read_preference rp)

Sets the read_preference for this operation.

Parameters
rpThe new read_preference.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ return_key() [1/2]

const 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.

Returns
Whether index keys associated with the query results are returned, instead of the actual query results themselves.
See also

◆ return_key() [2/2]

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.

Parameters
return_keyWhether to return the index keys associated with the query results, instead of the actual query results themselves.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ show_record_id() [1/2]

const 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.

Returns
Whether the record identifier is included.
See also

◆ show_record_id() [2/2]

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.

Parameters
show_record_idWhether to include the record identifier.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ skip() [1/2]

const stdx::optional< std::int64_t > & mongocxx::v_noabi::options::find::skip ( ) const

Gets the current number of documents to skip.

Returns
The number of documents to skip.
See also

◆ skip() [2/2]

find & mongocxx::v_noabi::options::find::skip ( std::int64_t skip)

Sets the number of documents to skip before returning results.

Parameters
skipThe number of documents to skip.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ sort() [1/2]

const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::options::find::sort ( ) const

Gets the current sort ordering for this query.

Returns
The current sort ordering.
See also

◆ sort() [2/2]

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.

Parameters
orderingDocument describing the order of the documents to be returned.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

The documentation for this class was generated from the following file: