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 abson_tto 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 π
π COPYRIGHT π
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
- 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