MONGOC_COLLEC...TION_WITH_OPTS(3)
π MONGOC_COLLEC...TION_WITH_OPTS(3) π
ok so bestie, welcome to libmongoc's mongoc_collection_create_bulk_operation_with_opts page πΈ this one's short and sweet, so grab a strawberry drink and let's go π
β¨ SYNOPSIS β¨
mongoc_bulk_operation_t *
mongoc_collection_create_bulk_operation_with_opts (
mongoc_collection_t *collection,
const bson_t *opts);
π PARAMETERS π
collectionβ amongoc_collection_t. that's your collection, your main character π
now opts β it can be NULL, or a BSON document stuffed with extra command options π here's what you can put in there:
writeConcernβ build yourself amongoc_write_concern_tand usemongoc_write_concern_append()to add the write concern toopts. the example code formongoc_client_write_command_with_opts()shows exactly how, iykyk β¨orderedβ set it tofalseif you want to attempt to insert all the documents and keep going even after errors happen. no stopping, no quitting, we persist πsessionIdβ first, construct amongoc_client_session_twithmongoc_client_start_session(). then you can begin a transaction withmongoc_client_session_start_transaction(), optionally passing amongoc_transaction_opt_tthat overrides the options inherited fromcollection, and then usemongoc_client_session_append()to add the session toopts. the example code formongoc_client_session_thas the whole lore π«Άletβ a BSON document made of any number of parameter names, each one followed by definitions of constants in the MQL Aggregate Expression language π¦commentβ abson_value_tthat specifies the comment to attach to this command. this comment will show up in log messages, profiler output, and currentOp output π needs MongoDB 4.4 or later, no cap
π₯ DESCRIPTION π₯
this function shall begin a new bulk operation β and after you create it, you may call various functions like mongoc_bulk_operation_update(), mongoc_bulk_operation_insert(), and others. go off π
and after you call mongoc_bulk_operation_execute(), the commands will be executed in as large as batches as reasonable by the client π₯ literally the client doing the most for you
π ERRORS π
errors are propagated when executing the bulk operation. that's it, that's the section, don't shoot the messenger π
π RETURNS π
a newly allocated mongoc_bulk_operation_t that should be freed with mongoc_bulk_operation_destroy() when it's no longer in use. clean up after yourself bestie, it's giving self-care π
β οΈ WARNING: failure to handle the result of this function is a programming error. like, actual oops. don't do it π
SEE ALSO:
- Bulk Write Operations
mongoc_bulk_operation_t
π§ AUTHOR π§
MongoDB, Inc β icons only π
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the whole page, bestie ππ version 2.5.6, dated Oct 09, 2026 β slay, go build something iconic π¦β¨
π¦ 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