MONGOC_CLIENT_DESTROY(3)

πŸ’… MONGOC_CLIENT_DESTROY πŸ’…

okay bestie, welcome to libmongoc β€” yes we're in the C bindings, yes it's giving low-level, and yes you're gonna slay it 🫢


✨ SYNOPSIS ✨

void
mongoc_client_destroy (mongoc_client_t *client);

πŸŽ€ DESCRIPTION πŸŽ€

So what this does is: it releases all the resources tied to client and frees the structure itself. Like, full cleanup, structure deallocated, done, periodt πŸ’€βœ¨

And the icon behavior? If client is NULL, it just... does nothing. No crash, no drama, no main-character meltdown. It's chill 🌸 (we love a function that handles the null case without making it your problem).

⚠️ okay this part is important, fr fr: only call mongoc_client_destroy() on a single-threaded client. Do not call it on a mongoc_client_t you got from a mongoc_client_pool_t β€” those go back to the pool via mongoc_client_pool_push() instead. Not optional, not a vibe suggestion, it's the rule πŸ‘‘πŸ˜­

🌈 PARAMETERS 🌈

  • client β€” a mongoc_client_t. that's it, that's the whole param πŸ¦‹

πŸ’œ SEE ALSO πŸ’œ

  • mongoc_client_pool_push() β€” use this to push a multi-threaded client back onto a pool. the correct move for pool clients, iykyk πŸ”₯

⭐ AUTHOR ⭐

MongoDB, Inc β€” icons only πŸ’–

2009-present, MongoDB, Inc. β€” like, they've been at this since 2009, respect on the name πŸŽ€


and that's the page bestie!! 🌟 this was libmongoc version 2.5.6, dated Oct 09, 2026 β€” go free your structures responsibly, mwah πŸ’…πŸ’–πŸ§š

πŸ“¦ where this page comes from