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 β€” a mongoc_structured_log_entry_t pointer. 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 🫢

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