MONGOC_URI_SET_COMPRESSORS(3)

πŸ’… MONGOC_URI_SET_COMPRESSORS πŸ’…

okay so bestie, we're in libmongoc land and today's main character is mongoc_uri_set_compressors β€” the little function that decides which compressors your URI is gonna flex with. iykyk 🫢


✨ SYNOPSIS ✨

bool
mongoc_uri_set_compressors (mongoc_uri_t *uri, const char *compressors);

πŸŽ€ PARAMETERS πŸŽ€

  • uri β€” a mongoc_uri_t. your uri. the one getting a glow-up πŸ’…
  • compressors β€” a string with one or more compressor names separated by commas (,) β€” for example "snappy,zlib" β€” or NULL. and here's the tea: passing NULL or an empty string clears any compressors already set on uri. poof, gone, no cap 🫧

🌸 DESCRIPTION 🌸

so this sets the URI's compressors after the URI has already been parsed from a string. the way it just overwrites any previously set value? iconic. previous value could never πŸ’€


πŸ¦‹ EXAMPLE πŸ¦‹

mongoc_client_t *client;
mongoc_uri_t *uri;

uri = mongoc_uri_new ("mongodb://localhost/");
mongoc_uri_set_compressors (uri, "snappy,zlib,zstd");
mongoc_client_new_from_uri (uri);
/* Snappy & zlib & zstd compressors are enabled */

look at that. Snappy & zlib & zstd all enabled, all living their best life ✨


⭐ RETURNS ⭐

returns false if the option can't be set β€” like, for example, if compressors isn't valid UTF-8 😭. and heads up: it logs a warning to stderr with the MONGOC_WARNING macro if compressor is not available.

ngl if you see that warning, your compressor just wasn't in the building πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc


2009-present, MongoDB, Inc.


and that's the whole vibe, bestie β€” this was libmongoc 2.5.6, dated Oct 09, 2026, signing off with love πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from