The example usage for bson_value_t listed in :
https://api.mongodb.org/libbson/current/bson_value_t.html
is using value not as a pointer. Also it should have used value->value_type instead of value->type.
const bson_value_t *value; value = bson_iter_value (&iter); if (value->value_type == BSON_TYPE_INT32) { printf ("%d\n", value->value.v_int32); }
https://github.com/mongodb/libbson/blob/master/doc/bson_value_t.page