SYNOPSIS

#include <bson.h>

bool
bson_append_document (bson_t       *bson,
                      const char   *key,
                      int           key_length,
                      const bson_t *value);

bool
bson_append_document_begin (bson_t     *bson,
                            const char *key,
                            int         key_length,
                            bson_t     *child);

bool
bson_append_document_end (bson_t *bson,
                          bson_t *child);

DESCRIPTION

The bson_append_document() function shall append child to bson using the specified key. The type of the field will be a document.

The bson_append_document_begin() function shall begin appending a sub-document to bson. Use child to add fields to the sub-document. When completed, call bson_append_document_end() to complete the element.

The bson_append_document_end() function shall complete the appending of a document with bson_append_document_begin(). child is invalid after calling this function.

RETURN VALUE

TRUE if the element was appended. Otherwise FALSE.

ERRORS

This function will only return FALSE if there was not enough space to store the element.

SEE ALSO

AUTHORS

This page was written by MongoDB, Inc.