MONGOC_URI_GET_COMPRESSORS(3)

πŸ’… MONGOC_URI_GET_COMPRESSORS(3) πŸ’…

okay so bestie, welcome to the libmongoc manual β€” this one's all about peeking at which compressors your URI has going on. no cap, it's a short one, so let's go ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

const bson_t *
mongoc_uri_get_compressors (const mongoc_uri_t *uri);

like, that's the whole vibe. one function, one job πŸ’–


πŸŽ€ PARAMETERS πŸŽ€

  • uri β€” a mongoc_uri_t. yeah. that's the whole parameter list. iconic of her honestly πŸ‘‘

🌸 DESCRIPTION 🌸

so what does it do? it hands you back a bson document where the enabled compressors are the keys β€” cute lil key party β€” or, and this is important, an empty document if no compressors were provided at all. so if u get back nothing, that's not a bug, that's just the truth πŸ’€


🌈 EXAMPLE 🌈

okay here's the whole thing in action, fr fr:

mongoc_client_t *client;
mongoc_uri_t *uri;

uri = mongoc_uri_new ("mongodb://localhost/?compressors=zlib,snappy,zstd");

if (bson_has_field (mongoc_uri_get_compressors (uri), "snappy")) {
   /* snappy enabled */
}

see how she builds the URI with zlib,snappy,zstd, then vibe-checks the returned doc for snappy? main character energy πŸ”₯ (and yes, client is declared there and never touched, we love a decorative variable 🫢)


⭐ RETURNS ⭐

a bson_t * β€” and listen bestie, it should not be modified or freed. like, don't touch it, don't free it, it's not yours, it's the URI's πŸ’…πŸ™ˆ


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” the icons themselves πŸ’œ


2009-present, MongoDB, Inc. β€” yeah, they've been at it a minute.


⚠️ reminder, because I care about u: that returned bson_t * is not yours to modify or free. hands off πŸ“

mwah, that's the page!! this was libmongoc version 2.5.6, dated Oct 09, 2026 β€” go forth and check ur compressors, bestie πŸ§šβœ¨πŸŽ€

πŸ“¦ where this page comes from