MONGOC_CLIENT_SET_ERROR_API(3)

πŸ’… MONGOC_CLIENT_SET_ERROR_API(3) β€” the libmongoc glow-up

okay so bestie, this is a libmongoc page, and it's literally about one tiny function that controls how the C Driver spills the tea when something goes wrong 😭✨


✨ SYNOPSIS ✨

bool
mongoc_client_set_error_api (mongoc_client_t *client, int32_t version);

That's it, that's the whole vibe. Two args, one bool, no cap. πŸ’–


🌸 DESCRIPTION 🌸

So this function is the one that configures how the C Driver reports errors β€” like, it's the settings menu for your error drama, iykyk. πŸ”₯

Also there's a whole section called Setting the Error API Version that you should go read, because that's where the lore lives. Go look at it, I'll wait. 🫢

🚨 BIG important warning, bestie, do NOT skip this: do not use this function with pooled clients. Like, ever. Pooled clients have their own thing going on β€” see mongoc_client_pool_set_error_api() for that. Use the wrong one and the vibe check fails, fr fr. πŸ’€

πŸ’… PARAMETERS πŸ’…

  • client β€” a mongoc_client_t. Yes queen, that's the client you're configuring. 🌈
  • version β€” the version of the error API. It's either MONGOC_ERROR_API_VERSION_LEGACY (the classic, the og, the retro) or MONGOC_ERROR_API_VERSION_2 (the new gen, main character energy). Pick one. πŸ‘‘

⭐ RETURNS ⭐

  • Returns true on success β€” slay, it worked, we love to see it. πŸŽ€
  • If any arguments are invalid, it returns false and logs an error. So yeah, you get a false and a little error message in the logs. Double notification, not me complaining though πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” the icons behind it all. 🧚


2009-present, MongoDB, Inc. β€” a whole legacy, honestly. πŸ’œ


and that's the page!! mwah πŸ’‹ β€” this one's from libmongoc, version 2.5.6, dated Oct 09, 2026. go forth and set your error API correctly bestie, mongoc_client_set_error_api(3) out. πŸ“βœ¨

πŸ“¦ where this page comes from