MongoDB C++ Driver mongocxx-4.0.0
|
#include <mongocxx/v_noabi/mongocxx/model/update_many.hpp>
Class representing a MongoDB update operation that modifies multiple documents.
Public Member Functions | |
update_many (bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update) | |
Constructs an update operation that will modify all documents matching the filter. | |
update_many (bsoncxx::v_noabi::document::view_or_value filter, const pipeline &update) | |
Constructs an update operation that will modify all documents matching the filter. | |
update_many (bsoncxx::v_noabi::document::view_or_value filter, std::initializer_list< _empty_doc_tag > update) | |
Constructs an update operation that will modify all documents matching the filter. | |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::array::view_or_value > & | array_filters () const |
Get array filters for this operation. | |
update_many & | array_filters (bsoncxx::v_noabi::array::view_or_value array_filters) |
Set array filters for this update operation. | |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & | collation () const |
Gets the collation option for this update operation. | |
update_many & | collation (bsoncxx::v_noabi::document::view_or_value collation) |
Sets the collation for this update operation. | |
const bsoncxx::v_noabi::document::view_or_value & | filter () const |
Gets the filter. | |
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::hint > & | hint () const |
Gets the current hint. | |
update_many & | hint (mongocxx::v_noabi::hint index_hint) |
Sets the index to use for this operation. | |
const bsoncxx::v_noabi::document::view_or_value & | update () const |
Gets the update document. | |
const bsoncxx::v_noabi::stdx::optional< bool > & | upsert () const |
Gets the current value of the upsert option. | |
update_many & | upsert (bool upsert) |
Sets the upsert option. | |
mongocxx::v_noabi::model::update_many::update_many | ( | bsoncxx::v_noabi::document::view_or_value | filter, |
bsoncxx::v_noabi::document::view_or_value | update ) |
Constructs an update operation that will modify all documents matching the filter.
filter | Document representing the criteria for applying the update. |
update | Document representing the modifications to be applied to matching documents. |
mongocxx::v_noabi::model::update_many::update_many | ( | bsoncxx::v_noabi::document::view_or_value | filter, |
const pipeline & | update ) |
Constructs an update operation that will modify all documents matching the filter.
filter | Document representing the criteria for applying the update. |
update | Pipeline representing the modifications to be applied to matching documents. |
mongocxx::v_noabi::model::update_many::update_many | ( | bsoncxx::v_noabi::document::view_or_value | filter, |
std::initializer_list< _empty_doc_tag > | update ) |
Constructs an update operation that will modify all documents matching the filter.
filter | Document representing the criteria for applying the update. |
update | Supports the empty update {}. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::array::view_or_value > & mongocxx::v_noabi::model::update_many::array_filters | ( | ) | const |
Get array filters for this operation.
update_many & mongocxx::v_noabi::model::update_many::array_filters | ( | bsoncxx::v_noabi::array::view_or_value | array_filters | ) |
Set array filters for this update operation.
array_filters | Array representing filters determining which array elements to modify. |
const bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::document::view_or_value > & mongocxx::v_noabi::model::update_many::collation | ( | ) | const |
Gets the collation option for this update operation.
update_many & mongocxx::v_noabi::model::update_many::collation | ( | bsoncxx::v_noabi::document::view_or_value | collation | ) |
Sets the collation for this update operation.
collation | The new collation. |
const bsoncxx::v_noabi::document::view_or_value & mongocxx::v_noabi::model::update_many::filter | ( | ) | const |
Gets the filter.
const bsoncxx::v_noabi::stdx::optional< mongocxx::v_noabi::hint > & mongocxx::v_noabi::model::update_many::hint | ( | ) | const |
Gets the current hint.
update_many & mongocxx::v_noabi::model::update_many::hint | ( | mongocxx::v_noabi::hint | index_hint | ) |
Sets the index to use for this operation.
index_hint | Object representing the index to use. |
const bsoncxx::v_noabi::document::view_or_value & mongocxx::v_noabi::model::update_many::update | ( | ) | const |
Gets the update document.
const bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::model::update_many::upsert | ( | ) | const |
Gets the current value of the upsert option.
update_many & mongocxx::v_noabi::model::update_many::upsert | ( | bool | upsert | ) |
Sets the upsert option.
When upsert is false
, update does nothing when no documents match the filter. 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. By default, upsert is unset by the driver, and the server-side default, false
, is used.
upsert | If 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. |