MONGOC_COLLECTION_INSERT_BULK(3)

🚨 WARNING 🚨

okay bestie, sit down for this one πŸ’–

Deprecated since version 1.9.0: Use mongoc_collection_insert_many() instead.

like, she's retired, she's on a lil vacation, she is NOT the one you want anymore. πŸ™ˆ


✨ SYNOPSIS ✨

bool
mongoc_collection_insert_bulk (mongoc_collection_t *collection,
                               mongoc_insert_flags_t flags,
                               const bson_t **documents,
                               uint32_t n_documents,
                               const mongoc_write_concern_t *write_concern,
                               bson_error_t *error);

this is mongoc_collection_insert_bulk, living in <strong>libmongoc</strong>, and yes she is still here, still in the docs, still deprecated. periodt. πŸ’…


🌸 PARAMETERS 🌸

  • collection β€” a mongoc_collection_t. the collection, the moment, the place where it all goes down. πŸŽ€
  • flags β€” a bitwise or of mongoc_insert_flags_t. stack those flags up, babes. πŸ”₯
  • documents β€” an array of bson_t. the whole lil squad of documents. πŸ’œ
  • n_documents β€” the number of documents in documents. yes queen, we count them. πŸ”’
  • write_concern β€” a mongoc_write_concern_t or NULL. you can pass NULL, she won't be mad. πŸ¦‹
  • error β€” an optional location for a bson_error_t or NULL. optional bestie, but if you want the tea, hand her a place to spill it. β˜•

πŸ¦‹ DESCRIPTION πŸ¦‹

So the vibe is: this function performs a bulk insert of all of the documents in documents. all of them!! at once!! iconic!! ✨

BUT β€” and this is the big but β€” this function is deprecated because it cannot accurately return which documents may have failed during the bulk insert. she just can't tell you who did what. the receipts are lost. πŸ’€


😭 ERRORS 😭

Errors are propagated via the error parameter. 🫢

A <strong>write concern timeout</strong> or <strong>write concern error</strong> is considered a failure. no cap, that counts as a fail, don't let anyone gaslight you into thinking otherwise. πŸ’…


πŸ‘‘ RETURNS πŸ‘‘

  • Returns true if successful. slay!! πŸŽ‰
  • Returns false and sets error if there are invalid arguments or a server or network error. oof. 😭 that's a no from her. πŸ’”

πŸŽ€ AUTHOR πŸŽ€

MongoDB, Inc the icons themselves, lowkey the main characters of this whole story. πŸ‘‘


2009-present, MongoDB, Inc. holding it down since 2009, fr fr. ✨


and that's the whole page bestie!! 🌈 this was libmongoc version 1.30.13, dated Oct 09, 2026, and she's serving deprecated-but-still-documented energy till the very end. go use mongoc_collection_insert_many() instead, iykyk!! πŸ’…πŸ’–βœ¨ πŸ¦‹πŸŒΈπŸŽ€πŸ«Ά

πŸ“¦ where this page comes from