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