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

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

Description

Class representing the optional arguments to a MongoDB update operation.

Public Member Functions

const stdx::optional< bsoncxx::v_noabi::array::view_or_value > & array_filters () const
 Get array filters for this operation.
 
updatearray_filters (bsoncxx::v_noabi::array::view_or_value array_filters)
 Set array filters for this operation.
 
const stdx::optional< bool > & bypass_document_validation () const
 Gets the current value of the bypass_document_validation option.
 
updatebypass_document_validation (bool bypass_document_validation)
 Sets the bypass_document_validation option. If true, allows the write to opt-out of document level validation.
 
const stdx::optional< bsoncxx::v_noabi::document::view_or_value > & collation () const
 Retrieves the current collation for this operation.
 
updatecollation (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.
 
updatecomment (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.
 
updatehint (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.
 
updatelet (bsoncxx::v_noabi::document::view_or_value let)
 Set the value of the let option.
 
const stdx::optional< bool > & upsert () const
 Gets the current value of the upsert option.
 
updateupsert (bool upsert)
 Sets the upsert option.
 
const stdx::optional< mongocxx::v_noabi::write_concern > & write_concern () const
 The current write_concern for this operation.
 
updatewrite_concern (mongocxx::v_noabi::write_concern wc)
 Sets the write_concern for this operation.
 

Member Function Documentation

◆ array_filters() [1/2]

const stdx::optional< bsoncxx::v_noabi::array::view_or_value > & mongocxx::v_noabi::options::update::array_filters ( ) const

Get array filters for this operation.

Returns
The current array filters.
See also

◆ array_filters() [2/2]

update & mongocxx::v_noabi::options::update::array_filters ( bsoncxx::v_noabi::array::view_or_value array_filters)

Set array filters for this operation.

Parameters
array_filtersArray representing filters determining which array elements to modify.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.
See also

◆ bypass_document_validation() [1/2]

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

Gets the current value of the bypass_document_validation option.

Returns
The optional value of the bypass_document_validation option.

◆ bypass_document_validation() [2/2]

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

Sets the bypass_document_validation option. If true, allows the write to opt-out of document level validation.

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.

◆ collation() [1/2]

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

Retrieves the current collation for this operation.

Returns
The current collation.
See also

◆ collation() [2/2]

update & mongocxx::v_noabi::options::update::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::update::comment ( ) const

Gets the current value of the comment option.

Returns
The current comment option.

◆ comment() [2/2]

update & mongocxx::v_noabi::options::update::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::update::hint ( ) const

Gets the current hint.

Returns
The current hint, if one is set.

◆ hint() [2/2]

update & mongocxx::v_noabi::options::update::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::update::let ( ) const

Gets the current value of the let option.

Returns
The current let option.

◆ let() [2/2]

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

◆ upsert() [1/2]

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

Gets the current value of the upsert option.

Returns
The optional value of the upsert option.

◆ upsert() [2/2]

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

Sets the upsert option.

By default, if no document matches the filter, the update operation does nothing. However, by specifying upsert as true, this operation either updates matching documents or inserts a new document using the update specification if no matching document exists.

Parameters
upsertIf set to true, creates a new document when no document matches the query criteria. The server-side default is false, which does not insert a new document if a match is not found.
Returns
A reference to the object on which this member function is being called. This facilitates method chaining.

◆ write_concern() [1/2]

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

The current write_concern for this operation.

Returns
The current write_concern
See also

◆ write_concern() [2/2]

update & mongocxx::v_noabi::options::update::write_concern ( mongocxx::v_noabi::write_concern wc)

Sets the write_concern for this operation.

Parameters
wcThe new 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: