BSON_READER_NEW_FROM_FILE(3)

✨ bson_reader_new_from_file β€” a libbson moment ✨

okay so bestie, welcome to the libbson corner of the man pages πŸ’– this one's about bson_reader_new_from_file, and honestly? it's giving "tiny function, big responsibility" energy. it takes a file and hands you back a whole reader. slay πŸŽ€


🌈 SYNOPSIS 🌈

bson_reader_t *
bson_reader_new_from_file (const char *path, bson_error_t *error);

that's it. that's the whole vibe. two args, one return, no cap πŸ’…


πŸ¦‹ PARAMETERS πŸ¦‹

  • path β€” a filename, and like… it's in the host filename encoding, bestie. that detail matters, ok? don't come for me, it's literally what the docs say 🫢
  • error β€” a bson_error_t. that's where the drama gets reported if things go sideways 😭

πŸ’– DESCRIPTION πŸ’–

so what does it do? it creates a brand new bson_reader_t using the file denoted by filename. that's the whole story, no plot twists 🌸 like, it looks at your file, it builds you a reader, iconic behavior honestly πŸ‘‘

(and yes, the parameter is called path up in the signature but filename down here in the description β€” that's just how the original rolls, iykyk πŸ™ˆ we love a little naming inconsistency, it's part of the charm.)


πŸ’€ ERRORS πŸ’€

errors are propagated via the error parameter. so like, nothing gets silently yeeted into the void β€” if something's wrong, it shows up in error where you can actually see it 🧚


⭐ RETURNS ⭐

  • on success β†’ a newly allocated bson_reader_t πŸŽ‰ (newly allocated, so like… that's yours to deal with, bestie β€” please free it)
  • on failure β†’ NULL, and error gets set πŸ“‰
lowkey important: NULL doesn't mean "no data", it means "it didn't work, check your error" β€” don't be out here dereferencing it, that's not the move πŸ˜­πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc 🫢


2009-present, MongoDB, Inc. β€” and yes that "present" is doing a lot of work, they've been at this a minute πŸ’œ


okay that's the whole page, bestie, you're basically a bson_reader_new_from_file expert now πŸŽ€βœ¨ mwah πŸ’‹

version 2.5.6 Β· dated Oct 09, 2026 Β· that's the tea, see u in the next man page πŸŒˆπŸ’…

πŸ“¦ where this page comes from