BSON_ITER_AS_DOUBLE(3)
π BSON_ITER_AS_DOUBLE β¨
okay so bestie, welcome to the BSON_ITER_AS_DOUBLE(3) page β this is libbson's little "just give me a double already" moment, and honestly? iconic. lowkey one of the most useful tiny functions you'll meet. let's get into it π«Ά
πΈ SYNOPSIS πΈ
double
bson_iter_as_double (const bson_iter_t *iter);
that's it. that's the whole signature. short, sweet, main character energy π
π PARAMETERS π
iterβ Abson_iter_t. yes, just the one. a single iterator, no cap. that's your whole input, bestie π¦
β¨ DESCRIPTION β¨
so what does it do? it fetches the current field as if it were a double. simple as that, fr fr π
bson_iter_as_double() will cast the following types to double:
BSON_TYPE_BOOLBSON_TYPE_DOUBLEBSON_TYPE_INT32BSON_TYPE_INT64
and any other value will return 0. yep. that's the whole deal β not a match, you get a 0, walk away π
π heads up bestie: "any other value will return0" means any other type literally gives you a zero back. not an error, not a warning β just0. so don't be out here assuming your value got through, okay? vibe check your iterator first π
π₯ RETURNS π₯
The value type casted to double. that's the tea β β you get your number back, typed as a double, slay π
π AUTHOR π
MongoDB, Inc β the legends themselves π«‘
β COPYRIGHT β
2009-present, MongoDB, Inc. β respectfully, that's a long run and we love that for them π
and that's the whole page, bestie! this gem is from libbson version 2.5.6, dated Oct 09, 2026 β so go forth, cast your iterator to a double, and remember: no cap, it's giving BSON_TYPE_DOUBLE energy. periodt π§ππΈ
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms