BSON_APPEND_AR...TOR_PACKED_BIT(3)

πŸ“¦
version 2.5.6 Β· 3 versions
, in epel 10

πŸ’… 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 β€” a bson_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 of key in bytes, or -1 to make it figure out the length with strlen(). the lazy-but-valid option, we love her 🌸
  • view β€” a bson_vector_packed_bit_const_view_t pointing at validated packed_bit BSON 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


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