Class representing a MongoDB update operation that modifies a single document.
More...
#include <update_one.hpp>
|
const bsoncxx::document::view_or_value & | filter () const |
| Gets the filter. More...
|
|
const bsoncxx::document::view_or_value & | update () const |
| Gets the update document. More...
|
|
update_one & | collation (bsoncxx::document::view_or_value collation) |
| Sets the collation for this update operation. More...
|
|
const stdx::optional< bsoncxx::document::view_or_value > & | collation () const |
| Gets the collation option for this update operation. More...
|
|
update_one & | hint (class hint index_hint) |
| Sets the index to use for this operation. More...
|
|
const stdx::optional< class hint > & | hint () const |
| Gets the current hint. More...
|
|
update_one & | upsert (bool upsert) |
| Sets the upsert option. More...
|
|
const stdx::optional< bool > & | upsert () const |
| Gets the current value of the upsert option. More...
|
|
update_one & | array_filters (bsoncxx::array::view_or_value array_filters) |
| Set array filters for this update operation. More...
|
|
const stdx::optional< bsoncxx::array::view_or_value > & | array_filters () const |
| Get array filters for this operation. More...
|
|
|
| update_one (bsoncxx::document::view_or_value filter, bsoncxx::document::view_or_value update) |
| Constructs an update operation that will modify a single document matching the filter. More...
|
|
| update_one (bsoncxx::document::view_or_value filter, const pipeline &update) |
| Constructs an update operation that will modify a single document matching the filter. More...
|
|
| update_one (bsoncxx::document::view_or_value filter, std::initializer_list< _empty_doc_tag > update) |
| Constructs an update operation that will modify a single document matching the filter. More...
|
|
Class representing a MongoDB update operation that modifies a single document.
◆ update_one() [1/3]
mongocxx::v_noabi::model::update_one::update_one |
( |
bsoncxx::document::view_or_value |
filter, |
|
|
bsoncxx::document::view_or_value |
update |
|
) |
| |
Constructs an update operation that will modify a single document matching the filter.
- Parameters
-
filter | Document representing the criteria for applying the update. |
update | Document representing the modifications to be applied to the matching document. |
◆ update_one() [2/3]
mongocxx::v_noabi::model::update_one::update_one |
( |
bsoncxx::document::view_or_value |
filter, |
|
|
const pipeline & |
update |
|
) |
| |
Constructs an update operation that will modify a single document matching the filter.
- Parameters
-
filter | Document representing the criteria for applying the update. |
update | Pipeline representing the modifications to be applied to the matching document. |
◆ update_one() [3/3]
mongocxx::v_noabi::model::update_one::update_one |
( |
bsoncxx::document::view_or_value |
filter, |
|
|
std::initializer_list< _empty_doc_tag > |
update |
|
) |
| |
Constructs an update operation that will modify a single document matching the filter.
- Parameters
-
filter | Document representing the criteria for applying the update. |
update | Supports the empty update {}. |
◆ array_filters() [1/2]
const stdx::optional<bsoncxx::array::view_or_value>& mongocxx::v_noabi::model::update_one::array_filters |
( |
| ) |
const |
◆ array_filters() [2/2]
update_one& mongocxx::v_noabi::model::update_one::array_filters |
( |
bsoncxx::array::view_or_value |
array_filters | ) |
|
◆ collation() [1/2]
const stdx::optional<bsoncxx::document::view_or_value>& mongocxx::v_noabi::model::update_one::collation |
( |
| ) |
const |
◆ collation() [2/2]
update_one& mongocxx::v_noabi::model::update_one::collation |
( |
bsoncxx::document::view_or_value |
collation | ) |
|
◆ filter()
const bsoncxx::document::view_or_value& mongocxx::v_noabi::model::update_one::filter |
( |
| ) |
const |
Gets the filter.
- Returns
- The filter to be used for the update operation.
◆ hint() [1/2]
const stdx::optional<class hint>& mongocxx::v_noabi::model::update_one::hint |
( |
| ) |
const |
Gets the current hint.
- Returns
- The current hint, if one is set.
◆ hint() [2/2]
update_one& mongocxx::v_noabi::model::update_one::hint |
( |
class 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_hint | Object representing the index to use. |
- Returns
- A reference to the object on which this member function is being called. This facilitates method chaining.
◆ update()
const bsoncxx::document::view_or_value& mongocxx::v_noabi::model::update_one::update |
( |
| ) |
const |
Gets the update document.
- Returns
- The modifications to be applied as part of the update.
◆ upsert() [1/2]
const stdx::optional<bool>& mongocxx::v_noabi::model::update_one::upsert |
( |
| ) |
const |
Gets the current value of the upsert option.
- Returns
- The optional value of the upsert option.
◆ upsert() [2/2]
update_one& mongocxx::v_noabi::model::update_one::upsert |
( |
bool |
upsert | ) |
|
Sets the upsert option.
When upsert is false
, if no document matches the filter, update does nothing. However, by specifying upsert as true
, this operation either updates a matching document or inserts a new document using the update specification if no matching document exists. By default upsert is false
.
- Parameters
-
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. |
The documentation for this class was generated from the following file: