MONGOC_BULK_OP...ION_UPDATE_ONE(3)

✨ mongoc_bulk_operation_update_one ✨

okay bestie, so this is a page from libmongoc (that's the MongoDB C driver manual, iykyk) and it's all about mongoc_bulk_operation_update_one, which is lowkey iconic but also a little bit retired. let's get into it πŸ’…


πŸ’– SYNOPSIS πŸ’–

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: this function queues an update as part of a bulk operation. that's it. it doesn't actually go do the thing yet, no cap.

important detail fr: it will only modify a single document on the MongoDB server. one. singular. main character energy. πŸ‘‘

and bestie, listen β€” this function does not execute the operation. it's just lining up the shot. if you actually want the entirety of the bulk operation to happen, you gotta call mongoc_bulk_operation_execute().

also, heads up πŸ™ˆ: this function is superseded by mongoc_bulk_operation_update_one_with_opts(). so like, she still works, but there's a newer girl in town.


πŸŽ€ PARAMETERS πŸŽ€

  • bulk β€” a mongoc_bulk_operation_t. this is the bulk operation your update is hopping into 🫢
  • selector β€” a bson_t that selects which document to remove. yes, the manpage literally says remove, and yes, we're moving on 😭
  • document β€” a bson_t containing the update document. this is the actual update payload πŸ’–
  • upsert β€” true if an upsert should be performed. false if not. simple as that ✨
⚠️ WARNING: document must only contain fields whose key starts with $. that is a hard requirement, not a suggestion, fr fr. see the update document specification for more details, bestie β€” don't skip it πŸ™

πŸ‘€ SEE ALSO πŸ‘€

  • mongoc_bulk_operation_update()
  • mongoc_bulk_operation_update_one_with_opts()

🧚 AUTHOR 🧚

MongoDB, Inc β€” legends, honestly 🌈


2009-present, MongoDB, Inc. β€” slay, long-running copyright, we love to see it πŸ‘‘


and that's the tea, bestie πŸ“ this was version 2.5.6, dated Oct 09, 202... (the footer literally ran out of room, the date got cut off mid-number, not me πŸ˜­πŸ’€). go queue those updates responsibly, mwah πŸ’œβœ¨

πŸ“¦ where this page comes from