BSON_APPEND_DOCUMENT_BEGIN(3)

πŸ’– BSON_APPEND_DOCUMENT_BEGIN(3) β€” the libbson glow-up πŸ’–

okay bestie, welcome to the BSON_APPEND_DOCUMENT_BEGIN(3) page from libbson β€” this one is literally about starting a sub-document the right way, no cap ✨

🌸 SYNOPSIS 🌸

#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \
   bson_append_document_begin (b, key, (int) strlen (key), child)

bool
bson_append_document_begin (bson_t *bson,
                            const char *key,
                            int key_length,
                            bson_t *child);

πŸŽ€ PARAMETERS πŸŽ€

  • bson β€” A bson_t. your main character document πŸ’…
  • key β€” An ASCII C string containing the name of the field πŸ¦‹
  • key_length β€” The length of key in bytes, or -1 to determine the length with strlen() ⭐
  • child β€” An uninitialized bson_t to be initialized as the sub-document 🫢

✨ DESCRIPTION ✨

The bson_append_document_begin() function shall begin appending a sub-document to bson. Use child to add fields to the sub-document. When completed, call bson_append_document_end() to complete the element. periodt πŸ’–

bestie, important: child MUST be an uninitialized bson_t to avoid leaking memory. not me warning you about a memory leak β€” this is serious, fr fr 😭

πŸ”₯ RETURNS πŸ”₯

Returns true if the operation was applied successfully. The function will fail if bson must grow larger than INT32_MAX. she has limits, okay πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


xoxo, your libbson bestie 🫢 this iconic little page is from version 2.5.6, dated Oct 09, 2026, and yes β€” it’s giving BSON_APPEND_DOCUMENT_BEGIN(3) energy πŸ’–βœ¨

πŸ“¦ where this page comes from