BSON_ITER_DOUBLE(3)

πŸ’… BSON_ITER_DOUBLE(3) πŸ’…

okay so bestie, welcome to the libbson manual, and specifically the page about bson_iter_double β€” she's a little function that goes and grabs you a double out of a BSON iterator. tiny page, iconic energy, let's get into it ✨


✨ SYNOPSIS ✨

here's the whole vibe β€” the macro first, then the function, copied exactly because we do not mess with code in this house 🫢

#define BSON_ITER_HOLDS_DOUBLE(iter) \
   (bson_iter_type ((iter)) == BSON_TYPE_DOUBLE)

double
bson_iter_double (const bson_iter_t *iter);

so the macro is your little vibe check: BSON_ITER_HOLDS_DOUBLE is literally just asking "does this iterator's type equal BSON_TYPE_DOUBLE?" and returning true/false accordingly. and then bson_iter_double is the actual main character that hands you the double 😌


🌸 PARAMETERS 🌸

  • iter β€” a bson_iter_t. that's it. that's the whole parameter list. she takes one (1) iterator and she's happy πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

bson_iter_double fetches the contents of a BSON_TYPE_DOUBLE field. that's the entire job. no cap. it reaches into your iterator, pulls out the double that's chilling in there, and gives it to you πŸŽ€

lowkey a good idea to run the BSON_ITER_HOLDS_DOUBLE check first so you know you're actually looking at a BSON_TYPE_DOUBLE field β€” the macro is right there in the synopsis for you, bestie, use her πŸ™ˆ

⭐ RETURNS ⭐

a double. yes really, that's the whole returns section. she said "you get a double, and that's the tea" πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” icons only, we love to see it 🫑


2009-present, MongoDB, Inc. β€” periodt, give credit where credit is due πŸ’…


and that's the page, bestie!! 🌈 this was libbson version 2.5.6, dated Oct 09, 2026 β€” screenshot it, bookmark it, tattoo it on your forearm, whatever works for you 😭🫢 go forth and read those doubles βœ¨πŸŽ€

πŸ“¦ where this page comes from