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 β€” A bson_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_BOOL
  • BSON_TYPE_DOUBLE
  • BSON_TYPE_INT32
  • BSON_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 return 0" means any other type literally gives you a zero back. not an error, not a warning β€” just 0. 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 🫑


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