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

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

Description

Class representing the optional arguments to a MongoDB find_and_modify replace operation.

Public Member Functions

const stdx::optional< bool > & bypass_document_validation () const
 The current setting for bypassing document validation.
 
find_one_and_replacebypass_document_validation (bool bypass_document_validation)
 Whether or not to bypass document validation for this operation.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation () const
 Retrieves the current collation for this operation.
 
find_one_and_replacecollation (bsoncxx::v_noabi::document::view_or_value collation)
 Sets the collation for this operation.
 
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_valuecomment () const
 Gets the current value of the comment option.
 
find_one_and_replacecomment (bsoncxx::v_noabi::types::bson_value::view_or_value comment)
 Set the value of the comment option.
 
const stdx::optional< mongocxx::v_noabi::hint > & hint () const
 Gets the current hint.
 
find_one_and_replacehint (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.
 
find_one_and_replacelet (bsoncxx::v_noabi::document::view_or_value let)
 Set the value of the let option.
 
const stdx::optional< std::chrono::milliseconds > & max_time () const
 The current max_time setting.
 
find_one_and_replacemax_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 > & projection () const
 Gets the current projection for this operation.
 
find_one_and_replaceprojection (bsoncxx::v_noabi::document::view_or_value projection)
 Sets a projection, which limits the fields to return.
 
const stdx::optional< mongocxx::v_noabi::options::return_document > & return_document () const
 Which version of the replaced document to return.
 
find_one_and_replacereturn_document (return_document return_document)
 Set the desired version of the replaced document to return, either the original document, or the replacement. By default, the original document is returned.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & sort () const
 Gets the current sort ordering.
 
find_one_and_replacesort (bsoncxx::v_noabi::document::view_or_value ordering)
 Sets the order by which to search the collection for a matching document.
 
const stdx::optional< bool > & upsert () const
 Gets the current upsert setting.
 
find_one_and_replaceupsert (bool upsert)
 Sets the upsert flag on the operation. When true, the operation creates a new document if no document matches the filter. When false, this operation will do nothing if there are no matching documents. The server-side default is false.
 
const stdx::optional< mongocxx::v_noabi::write_concern > & write_concern () const
 Gets the current write concern.
 
find_one_and_replacewrite_concern (mongocxx::v_noabi::write_concern write_concern)
 Sets the write concern for this operation.
 

Member Function Documentation

◆ bypass_document_validation() [1/2]

const stdx::optional< bool > & mongocxx::v_noabi::options::find_one_and_replace::bypass_document_validation ( ) const

The current setting for bypassing document validation.

Returns
the current bypass document validation setting.
See also

◆ bypass_document_validation() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::bypass_document_validation ( bool bypass_document_validation)

Whether or not to bypass document validation for this operation.

Note
On servers >= 3.2, the server applies validation by default. On servers < 3.2, this option is ignored.
Parameters
bypass_document_validationWhether or not to bypass document validation.
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_one_and_replace::collation ( ) const

Retrieves the current collation for this operation.

Returns
The current collation.
See also

◆ collation() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::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::types::bson_value::view_or_value > mongocxx::v_noabi::options::find_one_and_replace::comment ( ) const

Gets the current value of the comment option.

Returns
The current comment option.

◆ comment() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::comment ( bsoncxx::v_noabi::types::bson_value::view_or_value comment)

Set the value of the comment option.

Parameters
commentThe new comment option.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

◆ hint() [1/2]

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

Gets the current hint.

Returns
The current hint, if one is set.

◆ hint() [2/2]

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

Sets the index to use for this operation.

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_one_and_replace::let ( ) const

Gets the current value of the let option.

Returns
The current let option.

◆ let() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::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.

◆ max_time() [1/2]

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

The current max_time setting.

Returns
the current max allowed running time (in milliseconds).
See also

◆ max_time() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::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

◆ projection() [1/2]

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

Gets the current projection for this operation.

Returns
The current projection.
See also

◆ projection() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::projection ( bsoncxx::v_noabi::document::view_or_value projection)

Sets a projection, which limits the fields to return.

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

◆ return_document() [1/2]

const stdx::optional< mongocxx::v_noabi::options::return_document > & mongocxx::v_noabi::options::find_one_and_replace::return_document ( ) const

Which version of the replaced document to return.

Returns
Version of document to return, either original or replacement.
See also

◆ return_document() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::return_document ( return_document return_document)

Set the desired version of the replaced document to return, either the original document, or the replacement. By default, the original document is returned.

Parameters
return_documentVersion of document to return, either original or replaced.
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_one_and_replace::sort ( ) const

Gets the current sort ordering.

Returns
The current sort ordering.
See also

◆ sort() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::sort ( bsoncxx::v_noabi::document::view_or_value ordering)

Sets the order by which to search the collection for a matching document.

Warning
This can influence which document the operation modifies if the provided filter selects multiple documents.
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

◆ upsert() [1/2]

const stdx::optional< bool > & mongocxx::v_noabi::options::find_one_and_replace::upsert ( ) const

Gets the current upsert setting.

Returns
The current upsert setting.
See also

◆ upsert() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::upsert ( bool upsert)

Sets the upsert flag on the operation. When true, the operation creates a new document if no document matches the filter. When false, this operation will do nothing if there are no matching documents. The server-side default is false.

Parameters
upsertWhether or not to perform an upsert.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ write_concern() [1/2]

const stdx::optional< mongocxx::v_noabi::write_concern > & mongocxx::v_noabi::options::find_one_and_replace::write_concern ( ) const

Gets the current write concern.

Returns
The current write concern.
See also

◆ write_concern() [2/2]

find_one_and_replace & mongocxx::v_noabi::options::find_one_and_replace::write_concern ( mongocxx::v_noabi::write_concern write_concern)

Sets the write concern for this operation.

Parameters
write_concernObject representing the write concern.
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: