BSON_APPEND_AR...TOR_PACKED_BIT(3)
π BSON_APPEND_AR...TOR_PACKED_BIT(3) β¨
okay so bestie, this one is from the libbson manual (yes the name got cut off in the header, it's giving "we ran out of room π") and it's all about yeeting a packed_bit vector into a plain BSON array. short page, but every detail is a keeper. let's go π«Ά
β¨ SYNOPSIS β¨
the macro version, for when you're feeling efficient:
#define BSON_APPEND_ARRAY_FROM_VECTOR_PACKED_BIT(b, key, view) \
bson_append_array_from_vector_packed_bit (b, key, (int) strlen (key), view)
and the actual function underneath, no cap:
bool
bson_append_array_from_vector_packed_bit (bson_t *bson,
const char *key,
int key_length,
bson_vector_packed_bit_const_view_t view);
π PARAMETERS π
bsonβ abson_t. the doc you're writing into, main character of the operation πkeyβ an ASCII C string with the name of the field. literally just the label bestie π·οΈkey_lengthβ the length ofkeyin bytes, or-1to make it figure out the length withstrlen(). the lazy-but-valid option, we love her πΈviewβ abson_vector_packed_bit_const_view_tpointing at validatedpacked_bitBSON Binary Vector subtype data. note the validated β she expects the good stuff already β
π¦ DESCRIPTION π¦
so what it does: it converts the Vector that view points to into a plain BSON Array, and writes that array into bson under the name key. that's the whole vibe. packed_bit vector in, regular array out, slay β¨
π₯ RETURNS π₯
it returns true if the operation was applied successfully. periodt π
but heads up β it fails if appending the array grows bson larger than INT32_MAX. like, that's the ceiling, no negotiating π
ngl, watch your size. INT32_MAX is not a suggestion.
π SEE ALSO:
bson_array_builder_append_vector_packed_bit_elements()
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
okay that's the whole page bestie, go forth and append responsibly π§ββοΈπ
sign-off tea β: this was libbson version 2.5.6, dated Oct 09, 202β¦ (the footer got a little chopped, we still love her π) β mwah, see you in the next manpage π
π¦ 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