BSON_JSON_READER_READ(3)

πŸ’… BSON_JSON_READER_READ β€” the libbson era πŸ¦‹

okay so bestie, welcome to bson_json_reader_read from <rainbow>libbson</rainbow> β€” yes, that libbson, the manual section 3 one, we're literally in the big leagues now πŸ’–

✨ SYNOPSIS ✨

int
bson_json_reader_read (bson_json_reader_t *reader,
                       bson_t *bson,
                       bson_error_t *error);

like, that's the whole signature, no cap β€” three args, one int coming back at you 🫢


πŸŽ€ PARAMETERS πŸŽ€

  • reader β€” a bson_json_reader_t. this is your reader, the main character here πŸ‘‘ the one doing the actual reading, iykyk.
  • bson β€” a bson_t. this is where the doc lands. your destination. your little bson home 🏠
  • error β€” a bson_error_t. the vibe check container for anything that goes wrong 😭 if something breaks, it gets tucked in here.

🌸 DESCRIPTION 🌸

so what does it do? it reads the next BSON document from the underlying JSON source. that's it, that's the whole thing. it's giving "one document at a time, bestie" ✨ literally pulling the next doc out of your JSON source and handing it to you πŸ’…

no extra behaviors, no secret tricks β€” please don't invent lore that isn't in the manpage πŸ™ˆ


πŸ’€ ERRORS πŸ’€

errors get propagated via the error parameter. yeah. that bson_error_t up in the parameters? that's the one. if something goes sideways, the info travels back through error β€” it's not silently ignored, it's very much telling you πŸ“’


⭐ RETURNS ⭐

the return value is doing numbers, and each one means something different, so pay attention:

  • 1 β€” successful AND data was read. slay, we got a doc πŸ”₯
  • 0 β€” successful, but no data was read. everything's fine, there's just nothing there πŸ€·β€β™€οΈ no drama, no error.
  • -1 β€” there was an error 😭 that's the bad one, that's when you go check error.
lowkey those three values are the whole personality of this function, don't mix 'em up bestie πŸ’œ

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” yeah, them. iconic. periodt.


2009-present, MongoDB, Inc. β€” all rights reserved, respectfully πŸŽ€


okay that's the whole page, you ate that πŸ“ and fr fr, one last cute sign-off: this gorgeous little doc is from version 2.5.6, dated Oct 09, 2026 β€” save the date, bestie, BSON_JSON_READER_READ(3) is a whole moment πŸŒˆπŸ’…

πŸ“¦ where this page comes from