1BSON_CONTEXT_T(3)                   libbson                  BSON_CONTEXT_T(3)
2
3
4

NAME

6       bson_context_t - bson_context_t
7
8       BSON OID Generation Context
9

SYNOPSIS

11          #include <bson/bson.h>
12
13          typedef enum {
14            BSON_CONTEXT_NONE = 0,
15            BSON_CONTEXT_DISABLE_PID_CACHE = (1 << 2),
16          } bson_context_flags_t;
17
18          typedef struct _bson_context_t bson_context_t;
19
20          bson_context_t *
21          bson_context_get_default (void) BSON_GNUC_CONST;
22          bson_context_t *
23          bson_context_new (bson_context_flags_t flags);
24          void
25          bson_context_destroy (bson_context_t *context);
26

DESCRIPTION

28       The  bson_context_t  structure is context for generation of BSON Object
29       IDs. This context allows overriding behavior of  generating  ObjectIDs.
30       The  flags  BSON_CONTEXT_NONE,  BSON_CONTEXT_THREAD_SAFE, and BSON_CON‐
31       TEXT_DISABLE_PID_CACHE are the only ones used. The others have  no  ef‐
32       fect.
33

EXAMPLE

35          #include <bson/bson.h>
36
37          int
38          main (int argc, char *argv[])
39          {
40             bson_context_t *ctx = NULL;
41             bson_oid_t oid;
42
43             /* use default context, via bson_context_get_default() */
44             bson_oid_init (&oid, NULL);
45
46             /* specify a local context for additional control */
47             ctx = bson_context_new (BSON_CONTEXT_NONE);
48             bson_oid_init (&oid, ctx);
49
50             bson_context_destroy (ctx);
51
52             return 0;
53          }
54

AUTHOR

56       MongoDB, Inc
57
59       2017-present, MongoDB, Inc
60
61
62
63
641.21.1                           Mar 02, 2022                BSON_CONTEXT_T(3)
Impressum