BSON_GET_DATA(3)

πŸ’… bson_get_data β€” the libbson manual, bestie edition ✨

Okay so real talk, this is BSON_GET_DATA(3) from the libbson manual and it's literally the simplest little icon in the whole library. Let's get into it 🫢


✨ SYNOPSIS ✨

const uint8_t *
bson_get_data (const bson_t *bson);

That's it. That's the whole function signature. Look at her go πŸŽ€


πŸ¦‹ PARAMETERS πŸ¦‹

  • bson β€” a bson_t. That's the whole param list, no cap. Just hand her a document and she's good πŸ’–

🌸 DESCRIPTION 🌸

The bson_get_data() function shall return the raw buffer of a bson document. Like, the actual bytes. The unfiltered, unprocessed, straight-off-the-shelf bytes πŸ”₯

And the way that this is useful: you can pair it up with the len property of a bson_t if you want to copy the raw buffer around. So bson_get_data() tells you where the bytes start, len tells you how many there are, and together they're giving copy-the-whole-thing energy ✨ iykyk


πŸ’€ RETURNS πŸ’€

A buffer which should not be modified or freed.

Fr fr bestie, do NOT touch it and do NOT free it πŸ™ˆ It's not yours, it's hers. Just look at it respectfully and move on. Modifying or freeing it is not the vibe, okay? 😭

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” the main characters behind all of this 🫢


2009-present, MongoDB, Inc.


And that's the whole page, bestie β€” go forth and read those raw bytes responsibly πŸ¦‹βœ¨ This has been libbson version 2.5.6, dated Oct 09, 2026, signing off with a lil πŸ’… and a reminder that you ate that πŸ“

πŸ“¦ where this page comes from