BSON_APPEND_INT64(3)

πŸ’… BSON_APPEND_INT64(3) πŸ’…

okay bestie, so this is the libbson page for BSON_APPEND_INT64 β€” yes that's a 3 in the parens, that's a C library thing, iykyk ✨


🌸 SYNOPSIS 🌸

#define BSON_APPEND_INT64(b, key, val) \
   bson_append_int64 (b, key, (int) strlen (key), val)

bool
bson_append_int64 (bson_t *bson,
                   const char *key,
                   int key_length,
                   int64_t value);

so there's the macro version (convenience, slay πŸ’…) and the real function underneath β€” literally the same thing, the macro just fills in the strlen (key) for you like the little helper it is 🫢


πŸŽ€ PARAMETERS πŸŽ€

  • bson β€” a bson_t. that's your doc, your canvas, your main character 🌈
  • key β€” an ASCII C string holding the name of the field. give it a cute name, it deserves it ✨
  • key_length β€” the length of key in bytes, fr fr. or pass -1 and let it figure the length out with strlen() 😌
  • value β€” an int64_t. a whole 64 bits of signed integer energy πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

The bson_append_int64() function shall append a new element to bson containing a 64-bit signed integer. that's it. that's the whole vibe. big number goes in, doc gets one element richer, you move on with your life πŸ’–


πŸ’€ RETURNS πŸ’€

Returns true if the operation was applied successfully. like, genuinely successful, no cap 🫢

⚠️ okay important: the function will fail if appending value grows bson larger than INT32_MAX. so if your doc is already kinda thicc and this append pushes it over? nope. not happening. check your return value bestie, don't just assume 😭

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc


2009-present, MongoDB, Inc.


and that's the page, periodt πŸ’œ β€” this was libbson version 2.5.6, dated Oct 09, 2026. go append some integers, you got this 🧚

πŸ“¦ where this page comes from