1BSON_VALUE_T(3) libbson BSON_VALUE_T(3)
2
3
4
5BSON Boxed Container Type
6
8 #include <bson/bson.h>
9
10 typedef struct _bson_value_t {
11 bson_type_t value_type;
12 union {
13 bson_oid_t v_oid;
14 int64_t v_int64;
15 int32_t v_int32;
16 int8_t v_int8;
17 double v_double;
18 bool v_bool;
19 int64_t v_datetime;
20 struct {
21 uint32_t timestamp;
22 uint32_t increment;
23 } v_timestamp;
24 struct {
25 uint32_t len;
26 char *str;
27 } v_utf8;
28 struct {
29 uint32_t data_len;
30 uint8_t *data;
31 } v_doc;
32 struct {
33 uint32_t data_len;
34 uint8_t *data;
35 bson_subtype_t subtype;
36 } v_binary;
37 struct {
38 char *regex;
39 char *options;
40 } v_regex;
41 struct {
42 char *collection;
43 uint32_t collection_len;
44 bson_oid_t oid;
45 } v_dbpointer;
46 struct {
47 uint32_t code_len;
48 char *code;
49 } v_code;
50 struct {
51 uint32_t code_len;
52 char *code;
53 uint32_t scope_len;
54 uint8_t *scope_data;
55 } v_codewscope;
56 struct {
57 uint32_t len;
58 char *symbol;
59 } v_symbol;
60 bson_decimal128_t v_decimal128;
61 } value;
62 } bson_value_t;
63
65 The bson_value_t structure is a boxed type for encapsulating a runtime
66 determined type.
67
69 const bson_value_t *value;
70
71 value = bson_iter_value (&iter);
72
73 if (value->value_type == BSON_TYPE_INT32) {
74 printf ("%d\n", value->value.v_int32);
75 }
76
78 MongoDB, Inc
79
81 2017-present, MongoDB, Inc
82
83
84
85
861.25.1 Nov 08, 2023 BSON_VALUE_T(3)