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 true on success β€” and "success" here means either a valid environment setting was found, or the value is unset and opts will not be modified. Either way, you're slaying 🫢
  • If warnings are encountered in the environment, it returns false and 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

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