BSON_APPEND_ARRAY(3)
π BSON_APPEND_ARRAY(3) β the libbson glow-up π
okay bestie, so this is the libbson page for BSON_APPEND_ARRAY(3) and it's literally the moment your field gets to be an array. iconic behavior. let's get into it β¨
π¦ SYNOPSIS π¦
here's the convenience macro, and yes she's just doing strlen for you because she's sweet like that:
#define BSON_APPEND_ARRAY(b, key, val) \
bson_append_array (b, key, (int) strlen (key), val)
and here's the real function, the main character:
bool
bson_append_array (bson_t *bson,
const char *key,
int key_length,
const bson_t *array);
πΈ PARAMETERS πΈ
bsonβ abson_t. that's the doc you're appending into, the vibe container πkeyβ an ASCII C string holding the name of the field. name her, bestie β¨key_lengthβ how longkeyis in bytes, or pass-1and the function will figure it out withstrlen()for you. lowkey the-1is the move π«Άarrayβ abson_t. this is the thing becoming your array π
π DESCRIPTION π
bson_append_array() shall append array to bson using the key you specified. so far so slay π
the type of the field will be an array β but here's the part where you gotta pay attention ngl: it is the responsibility of the caller to make sure the keys of array are properly formatted with string keys like "0", "1", "2" and so forth. that's on you, bestie. the function is not gonna do that for you. no cap π
β RETURNS β
returns true if the operation was applied successfully π
the function fails if appending the array grows bson larger than INT32_MAX. that's the ceiling, and she will not go past it π§
ok that's the hard limit, INT32_MAX, not vibes-based. respect it π
π SEE ALSO π
SEE ALSO: bson_array_builder_t β go look at her, she's right there π§
π AUTHOR π
MongoDB, Inc β the icons themselves π«Ά
π COPYRIGHT π
2009-present, MongoDB, Inc. β periodt π
and that's the whole page, bestie!! this was BSON_APPEND_ARRAY(3) out of libbson version 2.5.6, dated Oct 09, 2026 β go forth and format your keys "0", "1", "2" like the icon you are πβ¨ππ¦
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms