MONGOC_BULK_O...ON_REPLACE_ONE(3)

πŸ’… MONGOC_BULK_O...ON_REPLACE_ONE(3) πŸ’…

okay bestie, so this is a page straight out of libmongoc β€” yes, the MongoDB C driver β€” and it's about queueing up a single document replacement inside a bulk op. no cap, it's a small one, so let's get into it 🫢


✨ SYNOPSIS ✨

void
mongoc_bulk_operation_replace_one (mongoc_bulk_operation_t *bulk,
                                   const bson_t *selector,
                                   const bson_t *document,
                                   bool upsert);

so like, what it does: it replaces a single document as part of a bulk operation. but here's the thing, and it's giving very important β€” this function only queues the operation. it does not run it. nope. nada. βœ‹

to actually make it happen, you gotta call mongoc_bulk_operation_execute(). that's the main character that does the real work πŸ‘‘

also, heads up babe: this function is superseded by mongoc_bulk_operation_replace_one_with_opts(). so like, it's still here, but the newer one is the vibe now 🌸


πŸŽ€ PARAMETERS πŸŽ€

  • bulk β€” a mongoc_bulk_operation_t. the bulk op container, the whole situation.
  • selector β€” a bson_t that selects which document to remove. yes, that's what it says πŸ’€ that's your target-picker.
  • document β€” a bson_t containing the replacement document. the glow-up you're swapping in πŸ’–
  • upsert β€” true if this should be an upsert.
⚠️ WARNING: document may not contain fields with keys containing . or $. literally don't do it. the dots and dollars are not invited to this party πŸ™ˆ periodt.

😭 ERRORS 😭

errors are propagated via mongoc_bulk_operation_execute() β€” so don't come looking for them here, they get passed over to the execute call, iykyk.

SEE ALSO: mongoc_bulk_operation_replace_one_with_opts()

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc


2009-present, MongoDB, Inc.


and that's the whole page, bestie β€” slay, you read it all πŸ¦‹βœ¨

libmongoc, version 2.5.6 β€” dated Oct 09, 2026 πŸ’… fr fr, see you in the next manpage πŸŒˆπŸŽ€

πŸ“¦ where this page comes from