MONGOC_ERROR_HAS_LABEL(3)

πŸ’… MONGOC_ERROR_HAS_LABEL πŸ’…

okay so bestie, welcome to libmongoc's very own label detector 😌 β€” this little function (mongoc_error_has_label, if we're being formal) is your new fave when an operation flops and you need to know why. It's giving "detective but make it C" πŸ”βœ¨


✨ SYNOPSIS ✨

bool
mongoc_error_has_label (const bson_t *reply, const char *label);

So here's the vibe: you hit a failed operation, you've got a reply, and you want to know if it's carrying one specific error label. That's literally the whole job 🫢. It tests whether a reply from a failed operation includes a specific error label β€” see Error Labels for details (iykyk), and see mongoc_client_session_start_transaction() for example code that demonstrates their use πŸ‘‘.


πŸŽ€ PARAMETERS πŸŽ€

  • reply β€” A non-NULL pointer to overwritable storage for a bson_t to contain the results πŸ’–. Note the non-NULL part, bestie β€” don't be out here passing NULL, that's not the move πŸ™ˆ.
  • label β€” The label to test for, such as "TransientTransactionError" or "UnknownTransactionCommitResult" πŸ¦‹. Drop the exact string you're hunting for in here.

⭐ RETURNS ⭐

Returns true if reply contains the error label πŸ’€πŸ”₯. That's it, that's the whole return situation. No cap.


🌸 AUTHOR 🌸

MongoDB, Inc β€” iconic behavior honestly πŸ‘‘


2009-present, MongoDB, Inc. πŸ’œ


and that's a wrap, bestie!! this page came to you straight from version 2.5.6, dated Oct 09, 2026 β€” go forth and check those labels fr fr πŸ§šβœ¨πŸ’…

πŸ“¦ where this page comes from