MONGOC_COLLECTION_UPDATE(3)
β¨ MONGOC_COLLECTION_UPDATE(3) β¨
okay bestie, welcome to the libmongoc page for MONGOC_COLLECTION_UPDATE(3) β this is the one where we go update some documents in a collection π
(manual section 3, in case the (3) was keeping you up at night π«Ά)
πΈ SYNOPSIS πΈ
here's the whole signature, and yes you're gonna want to copy it exactly because it's long:
bool
mongoc_collection_update (mongoc_collection_t *collection,
mongoc_update_flags_t flags,
const bson_t *selector,
const bson_t *update,
const mongoc_write_concern_t *write_concern,
bson_error_t *error);
like, look at all those params. it's giving β¨thoroughβ¨. she returns a bool, she takes six things, she's booked and busy.
π PARAMETERS π
collectionβ amongoc_collection_t. the collection. the main character. the place where the documents live πflagsβ a bitwise or ofmongoc_update_flags_t. yes, bitwise or, so you can stack them up like friendship bracelets π¦selectorβ abson_tcontaining the query to match documents for updating. this is the "who we're talking about" part, iykykupdateβ abson_tcontaining the update to perform. and heads up: if you're updating with a pipeline, this is abson_tarray instead π₯write_concernβ amongoc_write_concern_t. the write concern. slay.errorβ an optional location for abson_error_t, orNULL. optional!! no pressure β¨
π DESCRIPTION π
NOTE: to pass additional options, usemongoc_collection_update_one(),mongoc_collection_update_many(), ormongoc_collection_replace_one(). like, if you need more, those three are your girls π
this function shall update documents in collection that match selector. that's literally the whole gig, no cap.
by default, it only updates a single document. ok so the way this works: if you want to update multiple documents, set flags to MONGOC_UPDATE_MULTI_UPDATE. that's the switch. flip it. π«Ά
π ERRORS π
errors are propagated via the error parameter. that's where they show up. that's the vibe.
π RETURNS π
returns true if successful β¨
returns false and sets error if there are invalid arguments, or a server error, or a network error. so basically false has receipts β it tells you what went wrong π
and listen: a write concern timeout or write concern error is considered a failure. yes, even those. fr fr, don't assume it worked. π
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the page bestie, go forth and update responsibly π§π
sign-off time: this iconic little page is from version 2.5.6, dated Oct 09, 2026 β and it's MONGOC_COLLECTION_UPDATE(3) all the way down. periodt. β
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms