BSON_COPY_TO(3)

πŸ’… BSON_COPY_TO(3) πŸ’…

okay so bestie, welcome to libbson's bson_copy_to() page β€” literally the page header says BSON_COPY_TO(3), and the manual is libbson, so now you know what family we're in 🫢


✨ SYNOPSIS ✨

void
bson_copy_to (const bson_t *src, bson_t *dst);

that's it. that's the whole signature. it's giving "small function, big responsibility" πŸ’€


πŸŽ€ PARAMETERS πŸŽ€

  • src β€” a bson_t. the one you're copying from, the source, the original, the main character πŸ‘‘
  • dst β€” a bson_t. the one you're copying into. the destination. the understudy. it's getting the whole personality of src copied into it, ngl 🌸

πŸ¦‹ DESCRIPTION πŸ¦‹

so the bson_copy_to() function shall initialize dst with a copy of the contents of src πŸ’– like, dst comes out the other side holding exactly what src was holding. copy-paste but make it C. slay.

⚠️ okay this part is SO important, bestie, listen to me: dst MUST be an uninitialized bson_t β€” otherwise you leak memory 😭 fr fr, do not pass me some already-initialized struct and expect a cute outcome. that is not the vibe. memory leaks are the opposite of iconic. πŸ’€

so like β€” uninitialized dst. no cap. periodt. πŸŽ€


🌈 AUTHOR 🌈

MongoDB, Inc β€” yes, that MongoDB πŸ’… they wrote this. icons only.


2009-present, MongoDB, Inc. β€” yeah, they've been at it a minute, we stan longevity 🫢


and that's the whole page, bestie!! tysm for reading, drink some water, and remember: uninitialized dst or bust πŸ§šβ€β™€οΈβœ¨

this has been libbson 2.5.6, dated Oct 09, 2026 β€” catch you on the next man page, mwah πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from