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