1BSON_COPY_TO_EXCLUDING_NOINIT(3)    libbson   BSON_COPY_TO_EXCLUDING_NOINIT(3)
2
3
4

SYNOPSIS

6          void
7          bson_copy_to_excluding_noinit (const bson_t *src,
8                                         bson_t *dst,
9                                         const char *first_exclude,
10                                         ...) BSON_GNUC_NULL_TERMINATED;
11

PARAMETERS

13src: A bson_t.
14
15dst: A bson_t.
16
17first_exclude: The first field name to exclude.
18

DESCRIPTION

20       The bson_copy_to_excluding_noinit() function shall copy all fields from
21       src to dst except those specified by the variadic, NULL terminated list
22       of   keys   starting   from  first_exclude.   Works  the  same  way  as
23       bson_copy_to_excluding(), except does  not  call  bson_init()  on  dst.
24       This    function    should    be    preferred    in   new   code   over
25       bson_copy_to_excluding().
26
27       WARNING:
28          This is generally not needed except in very special situations.
29

EXAMPLE

31          #include <bson/bson.h>
32
33          int main ()
34          {
35             bson_t bson;
36             bson_t bson2;
37             char *str;
38
39             bson_init (&bson);
40             bson_append_int32 (&bson, "a", 1, 1);
41             bson_append_int32 (&bson, "b", 1, 2);
42             bson_append_int32 (&bson, "c", 1, 2);
43
44             bson_init (&bson2);
45             bson_copy_to_excluding_noinit (&bson, &bson2, "b", NULL);
46
47             str = bson_as_json (&bson2, NULL);
48             /* Prints
49              * { "a" : 1, "c" : 2 }
50              */
51             printf ("%s\n", str);
52             bson_free (str);
53
54             bson_destroy (&bson);
55             bson_destroy (&bson2);
56          }
57

AUTHOR

59       MongoDB, Inc
60
62       2017-present, MongoDB, Inc
63
64
65
66
671.25.1                           Nov 08, 2023 BSON_COPY_TO_EXCLUDING_NOINIT(3)
Impressum