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 Operators

  • pipeline – 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 the update page.

  • pipeline_len

  • is_multi – For [[5]]: If true, 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#
bool upsert#

If true, the operation acts as an upsert. Refer to: Insert a New Document if No Match Exists (Upsert).