Update#
- [[1]] amongoc_emitter [[type(amongoc_write_result)]] amongoc_update_many(
- amongoc_collection *coll,
- bson_view filter,
- bson_view updates,
- const amongoc_update_params *[[nullable]] params,
- [[2]] amongoc_emitter [[type(amongoc_write_result)]] amongoc_update_one(
- amongoc_collection *coll,
- bson_view filter,
- bson_view updates,
- const amongoc_update_params *[[nullable]] params,
- [[3]] amongoc_emitter [[type(amongoc_write_result)]] amongoc_update_many_with_pipeline(
- amongoc_collection *coll,
- bson_view filter,
- bson_view const *pipeline,
- size_t pipeline_len,
- const amongoc_update_params *[[nullable]] params,
- [[4]] amongoc_emitter [[type(amongoc_write_result)]] amongoc_update_one_with_pipeline(
- amongoc_collection *coll,
- bson_view filter,
- bson_view const *pipeline,
- size_t pipeline_len,
- const amongoc_update_params *[[nullable]] params,
- [[5]] amongoc_emitter [[type(amongoc_write_result)]] amongoc_update_ex(
- amongoc_collection *coll,
- bson_view filter,
- bson_view const *updates,
- size_t pipeline_len,
- bool is_multi,
- amongoc_update_params const *[[nullable]] params,
Perform an update operation.
- Parameters:
coll – The collection which contains the data to be modified.
filter – A filter to select the content to be modified.
updates – For
[[1]]and[[2]], this must point to a single document that contains one or more Update Operatorspipeline – For
[[3]]and[[4]]this must be a pointer to one or an array of documents that provide an Aggregation Pipeline. See: The Update with an Aggregation Pipeline section of theupdatepage.pipeline_len –
For
[[3]]and[[4]]specifies the number of documents pointed-to bypipeline.Advabced:
[[5]], setting this to0will treatupdatesas a pointer to a single document to be treated as either a replacement (foramongoc_replace_one()) or as an update specification (foramongoc_update_one()andamongoc_update_many()). Setting this to a positive number will treatupdatesas a pointer-to-array which specifies an aggregation pipeline (foramongoc_update_one_with_pipeline()andamongoc_update_many_with_pipeline()).
is_multi – For
[[5]]: Iftrue, updates all documents that match the filter. Otherwise, updates at most one document.
- Returns:
Resolves with an
amongoc_write_result
-
struct [[zero_initializable]] amongoc_update_params#
-
bson_view const *array_filters#
-
size_t array_filters_len#
-
bool bypass_document_validation#
-
bson_view collation#
-
bson_value_ref hint#
-
bson_view let#
-
bson_value_ref comment#
See also
-
bool upsert#
If
true, the operation acts as an upsert. Refer to: Insert a New Document if No Match Exists (Upsert).
-
bson_view const *array_filters#