bson_append_array_begin(3)

bson_append_array_begin3

Usage

#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \
   bson_append_array_begin (b, key, (int) strlen (key), child)
bool
bson_append_array_begin (bson_t *bson,
                         const char *key,
                         int key_length,
                         bson_t *child);

Parameters

•

bson: A bson_t.

•

key: A string containing the name for the key.

•

key_length: The length of key or -1 to call strlen().

•

child: A bson_t.

Overview

The bson_append_array_begin() function shall begin appending an array field to bson. This allows for incrementally building a sub-array. Doing so will generally yield better performance as you will serialize to a single buffer. When done building the sub-array, the caller MUST call bson_append_array_end().

For generating array element keys, see bson_uint32_to_string().

Consider using bson_array_builder_t to append an array without needing to generate array element keys.

Returns

Returns true if the operation was applied successfully. The function will fail if appending the array grows bson larger than INT32_MAX.

SEE ALSO:

bson_array_builder_t

Releases

5 releases since Debian 9 (Stretch); the text changed 4 times.

  1. 9
  2. 10
  3. 11
  4. 12
  5. 13

Author

MongoDB, Inc

From libbson-doc 1.30.4-1+deb13u3 in Debian 13 (Trixie). Parsed by carta from the page's man source.