MONGOC_STRUCT...ESSAGE_AS_BSON(3)
π MONGOC_STRUCT...ESSAGE_AS_BSON(3) π
okay bestie, so this one lives in libmongoc (that's the manual name, slay) and it's genuinely one of those tiny little functions that just does its thing and doesn't make a whole production out of it. β¨
πΈ SYNOPSIS πΈ
bson_t *
mongoc_structured_log_entry_message_as_bson (const mongoc_structured_log_entry_t *entry);
π¦ DESCRIPTION π¦
So what does it do?? It makes a new copy, as a bson_t, of the log entry's standardized BSON representation. That's it, that's the whole vibe. π
And here's the lowkey important part: when possible, a log handler should avoid serializing log messages that will be discarded. Like, don't do the work if nobody's gonna read it, yk? That's just wasted effort and nobody has time for that. π
Also each call allocates an independent copy of the message that must be freed β so yes, every single call gives you your own lil copy, and every single one of them is your responsibility to free later. No ghosting your allocations, bestie. π«Ά
π PARAMETERS π
entryβ amongoc_structured_log_entry_tpointer. that's it. that's the whole parameter list. β¨
π RETURNS π
A new allocated bson_t that must be freed with a call to bson_destroy(). periodt. π―
fr fr do not forget the bson_destroy() or it's giving memory leak energy π
SEE ALSO: Structured Logging π
π AUTHOR π
MongoDB, Inc β iconic, we stan π«Ά
π COPYRIGHT π
2009-present, MongoDB, Inc. π
and that's the whole page bestie!! version 2.5.6, dated Oct 09, 2026 β go forth and free your bson_ts π
β¨π
π¦ 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