SYNOPSIS

#include <bson.h>

bool
bson_append_code (bson_t     *bson,
                  const char *key,
                  int         key_length,
                  const char *javascript);

bool
bson_append_code_with_scope (bson_t       *bson,
                             const char   *key,
                             int           key_length,
                             const char   *javascript,
                             const bson_t *scope);

DESCRIPTION

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.

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.

key_length may be -1 if key is NULL terminated.

RETURN VALUE

TRUE if the element was appended to bson, otherwise FALSE.

ERRORS

FALSE is returned if there was not enough space to append the document.

AUTHORS

This page was written by MongoDB, Inc.