MONGOC_BULK_O...MANY_WITH_OPTS(3)

hiii bestie πŸ’– welcome to the MONGOC_BULK_O...MANY_WITH_OPTS(3) page from libmongoc β€” yes the title got truncated, but the function is mongoc_bulk_operation_update_many_with_opts() and she is that girl ✨

✨ SYNOPSIS ✨

          bool
          mongoc_bulk_operation_update_many_with_opts (mongoc_bulk_operation_t *bulk,
                                                       const bson_t *selector,
                                                       const bson_t *document,
                                                       const bson_t *opts,
                                                       bson_error_t *error); /* OUT */

Okay so this function queues an update as part of a bulk operation. It does not execute the operation, bestie β€” it just lines it up. To execute the entirety of the bulk operation, call mongoc_bulk_operation_execute(). Periodt πŸ’…

⚠️ WARNING: document MUST only contain fields whose key starts with $. See the update document specification for more details. No cap, this one matters 😭

πŸ’– PARAMETERS πŸ’–

  • bulk β€” a mongoc_bulk_operation_t. The main-character bulk operation itself πŸ‘‘
  • selector β€” a bson_t that selects which documents to remove.
  • document β€” a bson_t containing the update document.
  • error β€” a bson_error_t any errors that may have occurred. That's where the yikes go πŸ™ˆ

opts may be NULL or a BSON document with additional command options:

  • validate β€” construct a bitwise-or of all desired bson_validate_flags_t. Set to false to skip client-side validation of the provided BSON documents. Lowkey useful, highkey valid ✨
  • collation β€” configure textual comparisons. See Setting Collation Order, and the MongoDB Manual entry on Collation. Collation requires MongoDB 3.2 or later, otherwise an error is returned. Respect the version, bestie 🫢
  • hint β€” a document or string that specifies the index to use to support the query predicate. It's giving "use the right index" energy πŸ”₯
  • upsert β€” if true, insert a document if none match selector. Surprise insertion moment πŸ‘€
  • arrayFilters β€” an array of filters specifying to which array elements an update should apply. For when you need to be specific-specific πŸ’…

😭 ERRORS 😭

Operation errors are propagated via mongoc_bulk_operation_execute(), while argument validation errors are reported by the error argument. So yeah β€” some drama shows up at execute time, some shows up in error 🫠

🌟 RETURNS 🌟

Returns true on success, and false if there is a server or network error or if passed invalid arguments. Simple vibe check: true slays, false means something went off πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

mongoc_bulk_operation_update_one_with_opts() β€” go read that one too, bestie πŸ’œ

🫢 AUTHOR 🫢

MongoDB, Inc

2009-present, MongoDB, Inc.


okay byeee bestie πŸ’– β€” this was libmongoc 2.5.6, dated Oct 09, 2026. mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from