MongoDB C++ Driver  mongocxx-3.4.0
Public Member Functions | List of all members
mongocxx::options::update Class Reference

Class representing the optional arguments to a MongoDB update operation. More...

#include <update.hpp>

Public Member Functions

updatebypass_document_validation (bool bypass_document_validation)
 Sets the bypass_document_validation option. More...
 
const stdx::optional< bool > & bypass_document_validation () const
 Gets the current value of the bypass_document_validation option. More...
 
updatecollation (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...
 
updateupsert (bool upsert)
 Sets the upsert option. More...
 
const stdx::optional< bool > & upsert () const
 Gets the current value of the upsert option. More...
 
updatewrite_concern (class write_concern wc)
 Sets the write_concern for this operation. More...
 
const stdx::optional< class write_concern > & write_concern () const
 The current write_concern for this operation. More...
 
updatearray_filters (bsoncxx::array::view_or_value array_filters)
 Set array filters for this operation. More...
 
const stdx::optional< bsoncxx::array::view_or_value > & array_filters () const
 Get array filters for this operation. More...
 

Detailed Description

Class representing the optional arguments to a MongoDB update operation.

Member Function Documentation

◆ array_filters() [1/2]

update& mongocxx::options::update::array_filters ( bsoncxx::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
https://docs.mongodb.com/manual/reference/command/update/

◆ array_filters() [2/2]

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

Get array filters for this operation.

Returns
The current array filters.
See also
https://docs.mongodb.com/manual/reference/command/update/

◆ bypass_document_validation() [1/2]

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

◆ bypass_document_validation() [2/2]

const stdx::optional<bool>& mongocxx::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.

◆ collation() [1/2]

update& mongocxx::options::update::collation ( bsoncxx::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
https://docs.mongodb.com/master/reference/collation/

◆ collation() [2/2]

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

Retrieves the current collation for this operation.

Returns
The current collation.
See also
https://docs.mongodb.com/master/reference/collation/

◆ upsert() [1/2]

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

◆ upsert() [2/2]

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

Gets the current value of the upsert option.

Returns
The optional value of the upsert option.

◆ write_concern() [1/2]

update& mongocxx::options::update::write_concern ( class 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
https://docs.mongodb.com/master/core/write-concern/

◆ write_concern() [2/2]

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

The current write_concern for this operation.

Returns
The current write_concern
See also
https://docs.mongodb.com/master/core/write-concern/

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