MONGOC_BULK_OPERATION_EXECUTE(3)

okay bestie, welcome to the libmongoc docs πŸ’– this page is all about mongoc_bulk_operation_execute() β€” the moment all your queued-up bulk ops finally get their main character moment. πŸ’…

✨ SYNOPSIS ✨

uint32_t
mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk,
                               bson_t *reply,
                               bson_error_t *error);

This function executes all operations queued into the bulk operation. Unless ordered: false was specified in the opts passed to mongoc_collection_create_bulk_operation_with_opts(), then forward progress will be stopped upon the first error. πŸ›‘

It is only valid to call mongoc_bulk_operation_execute() once on the same mongoc_bulk_operation_t. Calling repeatedly results in error. Call mongoc_bulk_operation_destroy() to destroy bulk afterwards. 🫢

Changed in version 2.0.0: Calling mongoc_bulk_operation_execute() repeatedly results in an error. ⚠️

WARNING: reply is always initialized, even upon failure. Callers must call bson_destroy() to release this potential allocation. πŸ˜­πŸ’Έ

🌸 PARAMETERS 🌸

  • bulk β€” A mongoc_bulk_operation_t. The bulk operation itself, living its best life. πŸ‘‘
  • reply β€” A maybe-NULL pointer to overwritable storage for a bson_t to contain the results. πŸŽ€
  • error β€” An optional location for a bson_error_t or NULL. πŸ¦‹

πŸ’€ ERRORS πŸ’€

Errors are propagated via the error parameter. No cap. πŸ“¬

⭐ RETURNS ⭐

On success, returns the server id used. On failure, returns 0 and sets error. 😭

A write concern timeout or write concern error is considered a failure. 🚨

The reply document counts operations and collects error information. See Bulk Write Operations for examples. πŸ“

πŸ‘€ SEE ALSO πŸ‘€

  • Bulk Write Operations
  • mongoc_bulk_operation_get_server_id(), which gets the id of the server used even if the operation failed. πŸ•΅οΈβ€β™€οΈ

🧚 AUTHOR 🧚

MongoDB, Inc

2009-present, MongoDB, Inc.

okay that's the whole page, bestie β€” brought to you by libmongoc version 2.5.6, dated Oct 09, 2026, and still titled MONGOC_BULK_OPERATION_EXECUTE(3) because we keep the lore intact. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from