1BSON_CONTEXT_T(3)                   libbson                  BSON_CONTEXT_T(3)
2
3
4
5BSON OID Generation Context
6

SYNOPSIS

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

DESCRIPTION

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

EXAMPLE

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

AUTHOR

53       MongoDB, Inc
54
56       2017-present, MongoDB, Inc
57
58
59
60
611.25.1                           Nov 08, 2023                BSON_CONTEXT_T(3)
Impressum