bson_destroy_with_steal (3) - Linux Manuals
bson_destroy_with_steal: The bson_destroy_with_steal() function shall destroy a bson_t structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a bson_t that is not a top-level bson_t, shuch as those initialized with bson_append_document_begin(), bson_append_array_begin(), and bson_writer_begin().
Command to display bson_destroy_with_steal
manual in Linux: $ man 3 bson_destroy_with_steal
NAME
bson_destroy_with_steal() - The bson_destroy_with_steal() function shall destroy a bson_t structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a bson_t that is not a top-level bson_t, shuch as those initialized with bson_append_document_begin(), bson_append_array_begin(), and bson_writer_begin().
SYNOPSIS
uint8_t *
bson_destroy_with_steal (bson_t *bson,
bool steal,
uint32_t *length);
PARAMETERS
- bson
-
A
bson_t
\&.
- steal
-
A bool indicating if the underlying buffer should be stolen.
- length
-
A location for storing the resulting buffer length.
DESCRIPTION
The
bson_destroy_with_steal(3)
function shall destroy a
bson_t
structure but return the underlying buffer instead of freeing it. If steal is false, this is equivalent to calling bson_destroy(). It is a programming error to call this function on a
bson_t
that is not a top-level
bson_t
, shuch as those initialized with
bson_append_document_begin(3)
,
bson_append_array_begin(3)
, and
bson_writer_begin(3)
\&.
RETURNS
bson_destroy_with_steal(3)
shall return a buffer containing the contents of the
bson_t
if
steal
is non-zero. This should be freed with
bson_free(3)
when no longer in use.
length
will be set to the length of the bson document if non-NULL.
COLOPHON
This page is part of libbson.
Please report any bugs at
https://jira.mongodb.org/browse/CDRIVER.
Pages related to bson_destroy_with_steal
- bson_destroy (3) - The bson_destroy() function shall free an allocated bson_t structure.
- bson_append_array (3) - The bson_append_array() function shall append child to bson using the specified key. The type of the field will be an array, but it is the responsibility of the caller to ensure that the keys of child are properly formatted with string keys such as "0", "1", "2" and so forth.
- bson_append_array_begin (3) - 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().
- bson_append_array_end (3) - The bson_append_array_end() function shall complete the appending of an array field started with bson_append_array_begin(). child is invalid after calling this function.
- bson_append_binary (3) - The bson_append_binary() function shall append a new element to bson containing the binary data provided.
- bson_append_bool (3) - The bson_append_bool() function shall append a new element to bson containing the boolean provided.
- bson_append_code (3) - The bson_append_code() function shall append a new element to bson using the UTF-8 encoded javascript provided. javascript must be a NULL terminated C string.
- bson_append_code_with_scope (3) - The bson_append_code_with_scope() function shall perform like bson_append_code() except it allows providing a scope to the javascript function in the form of a bson document.
- bson_append_date_time (3) - The bson_append_date_time() function shall append a new element to a bson document containing a date and time with no timezone information. value is assumed to be in UTC format of milliseconds since the UNIX epoch. value MAY be negative.