1BSON_COPY_TO_EXCLUDING_NOINIT(3)    Libbson   BSON_COPY_TO_EXCLUDING_NOINIT(3)
2
3
4

NAME

6       bson_copy_to_excluding_noinit - bson_copy_to_excluding_noinit()
7

SYNOPSIS

9          void
10          bson_copy_to_excluding_noinit (const bson_t *src,
11                                         bson_t *dst,
12                                         const char *first_exclude,
13                                         ...) BSON_GNUC_NULL_TERMINATED;
14

PARAMETERS

16       · src: A bson_t.
17
18       · dst: A bson_t.
19
20       · first_exclude: The first field name to exclude.
21

DESCRIPTION

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

EXAMPLE

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

AUTHOR

61       MongoDB, Inc
62
64       2017-present, MongoDB, Inc
65
66
67
68
691.15.2                           Nov 06, 2019 BSON_COPY_TO_EXCLUDING_NOINIT(3)
Impressum