1BSON_APPEND_CODE_WITH_SCOPE(3) libbson BSON_APPEND_CODE_WITH_SCOPE(3)
2
3
4
6 #define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \
7 bson_append_code_with_scope (b, key, (int) strlen (key), val, scope)
8
9 bool
10 bson_append_code_with_scope (bson_t *bson,
11 const char *key,
12 int key_length,
13 const char *javascript,
14 const bson_t *scope);
15
17 • bson: A bson_t.
18
19 • key: An ASCII C string containing the name of the field.
20
21 • key_length: The length of key in bytes, or -1 to determine the length
22 with strlen().
23
24 • javascript: A NULL-terminated UTF-8 encoded string containing the
25 javascript fragment.
26
27 • scope: Optional bson_t containing the scope for javascript.
28
30 The bson_append_code_with_scope() function shall perform like
31 bson_append_code() except it allows providing a scope to the javascript
32 function in the form of a bson document.
33
34 If scope is NULL, this function appends an element with BSON type
35 "code", otherwise with BSON type "code with scope".
36
38 Returns true if the operation was applied successfully. The function
39 will fail if appending javascript and scope grows bson larger than
40 INT32_MAX.
41
43 MongoDB, Inc
44
46 2017-present, MongoDB, Inc
47
48
49
50
511.25.1 Nov 08, 2023 BSON_APPEND_CODE_WITH_SCOPE(3)