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 } value;
64 } bson_value_t;
65
67 The bson_value_t structure is a boxed type for encapsulating a runtime
68 determined type.
69
71 const bson_value_t *value;
72
73 value = bson_iter_value (&iter);
74
75 if (value->value_type == BSON_TYPE_INT32) {
76 printf ("%d\n", value->value.v_int32);
77 }
78
80 MongoDB, Inc
81
83 2017-present, MongoDB, Inc
84
85
86
87
881.13.1 Jan 24, 2019 BSON_VALUE_T(3)