1BSON_ARRAY_AS_CANONICAL_EXTENDED_JSONl(i3bB)bSsOoNn_ARRAY_AS_CANONICAL_EXTENDED_JSON(3)
2
3
4

SYNOPSIS

6          char *
7          bson_array_as_canonical_extended_json (const bson_t *bson, size_t *length);
8

PARAMETERS

10bson: A bson_t.
11
12length: An optional location for the length of the resulting string.
13

DESCRIPTION

15       The  bson_array_as_canonical_extended_json()  encodes  bson  as a UTF-8
16       string in the canonical MongoDB Extended JSON format, except the outer‐
17       most element is encoded as a JSON array, rather than a JSON document.
18
19       The  caller  is  responsible  for  freeing  the resulting UTF-8 encoded
20       string by calling bson_free() with the result.
21
22       If non-NULL, length will be set to the length of the result in bytes.
23

RETURNS

25       If successful, a newly allocated UTF-8 encoded  string  and  length  is
26       set.
27
28       Upon failure, NULL is returned.
29

EXAMPLE

31          #include <bson/bson.h>
32
33          int main ()
34          {
35             bson_t bson;
36             char *str;
37
38             bson_init (&bson);
39             /* BSON array is a normal BSON document with integer values for the keys,
40              * starting with 0 and continuing sequentially
41              */
42             BSON_APPEND_INT32 (&bson, "0", 1);
43             BSON_APPEND_UTF8 (&bson, "1", "bar");
44
45             str = bson_array_as_canonical_extended_json (&bson, NULL);
46             /* Prints
47              * [ { "$numberInt" : 1 }, "bar" ]
48              */
49             printf ("%s\n", str);
50             bson_free (str);
51
52             bson_destroy (&bson);
53          }
54

AUTHOR

56       MongoDB, Inc
57
59       2017-present, MongoDB, Inc
60
61
62
63
641.25.1                           Nov 08B,SO2N0_2A3RRAY_AS_CANONICAL_EXTENDED_JSON(3)
Impressum