MONGOC_STRUCT...ENGTH_FROM_ENV(3)
πΈ MONGOC_STRUCT...ENGTH_FROM_ENV(3) πΈ
okay so bestie, this is the page for mongoc_structured_log_opts_set_max_document_length_from_env β it lives in libmongoc and honestly it's giving "little function, big job" energy π
β¨ SYNOPSIS β¨
bool
mongoc_structured_log_opts_set_max_document_length_from_env (mongoc_structured_log_opts_t *opts);
so like, what does it do? π«Ά It sets a maximum document length, and it pulls that value straight out of the MONGODB_LOG_MAX_DOCUMENT_LENGTH environment variable β but only if a valid setting is actually found in there. If it's not valid, no cap, no nothing, it just doesn't take.
wanna know what "valid" even looks like? π The supported environment variable formats are described over in mongoc_structured_log_opts_new() β go read that one, iykyk.
and ngl, parse errors? They can trigger a warning message, which gets delivered through unstructured logging. So it's not silent, bestie, it's just chatting in a different channel π¬
here's the part where it gets kinda iconic: this whole thing happens automatically when mongoc_structured_log_opts_new() establishes defaults. Like, it's already doing it for you, no cap β¨
but β and this is the tea β β any subsequent programmatic modifications you make to the mongoc_structured_log_opts_t will override the environment variable settings. Your code wins, periodt.
now, some of y'all want the opposite vibe entirely: you want the environment variables to override your programmatic settings. main character env energy. π In that case, you can call mongoc_structured_log_opts_set_max_document_length_from_env() after calling mongoc_structured_log_opts_set_max_document_length(). That processes the environment a second time, which lets it override your customized defaults. It's literally the sequel, and the sequel slaps π
π RETURNS π
- Returns
trueon success β and "success" here means either a valid environment setting was found, or the value is unset andoptswill not be modified. Either way, you're slaying π«Ά - If warnings are encountered in the environment, it returns
falseand may log additional information to the unstructured logging facility. π
β οΈ big note bestie: by design, these errors are default non-fatal. And when mongoc_structured_log_opts_new() internally calls this function, it totally ignores the return value. Like, doesn't even look at it. π
π SEE ALSO:
- Structured Logging
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the whole page, bestie!! go forth and configure your document lengths responsibly π¦β¨
mwah π β signed, sealed, and shipped as libmongoc version 2.5.6, dated Oct 09, 2026. π
π¦ 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