BSON_JSON_READER_NEW(3)
π BSON_JSON_READER_NEW(3) β like, the libbson one, section 3, bestie β¨
okay so picture this: you're deep in libbson land and you need a reader that just... streams. that's literally this whole function. it's giving "main character energy" for JSON reading, periodt.
β¨ SYNOPSIS β¨
bson_json_reader_t *
bson_json_reader_new (void *data,
bson_json_destroy_cb dcb,
bool allow_multiple,
size_t buf_size);
wait no π β do NOT let me mess up the order, that's the one thing we do not do. the actual signature is exactly this, copy it character for character babes:
bson_json_reader_t *
bson_json_reader_new (void *data,
bson_json_reader_cb cb,
bson_json_destroy_cb dcb,
bool allow_multiple,
size_t buf_size);
five params, in that exact order. cb goes second, dcb third. slay π«Ά
π PARAMETERS π
dataβ a user-defined pointer. that's your little payload, bestie, it's whatever you want to hand over. you do you πcbβ abson_json_reader_cb. your callback, the one doing the actual reading work.dcbβ abson_json_destroy_cb. the cleanup callback, so nothing leaks. iconic behaviour honestly.allow_multipleβ unused. like, genuinely unused. it's just sitting there. not me pointing at it πbuf_sizeβ asize_tcontaining the requested internal buffer size. you pick how big the internal buffer is, we simply respect it β¨
πΈ DESCRIPTION πΈ
creates a new bson_json_reader_t that can read from an arbitrary data source in a streaming fashion. yes, streaming. we are not loading the whole thing into memory like some kind of clown π€‘ β it flows, it vibes, it reads as it goes. highkey elegant.
and because you're gonna ask: the allow_multiple parameter is unused. i said what i said. it's in the signature, it's in the docs, and it does nothing. no cap. π§
β οΈ heads up: allow_multiple is unused. i'm repeating it a third time because the manpage repeats it a third time, and honestly? it deserves the airtime at this point π
π RETURNS π
a newly allocated bson_json_reader_t β fresh out the oven, yours to keep π
and you must free it with bson_json_reader_destroy(). that's not a suggestion, that's a whole thing. free your reader or the memory leaks and it's not cute π¨π
π AUTHOR π
MongoDB, Inc π (yes, that MongoDB)
β COPYRIGHT β
2009-present, MongoDB, Inc. β everything from 2009 up through today, all theirs π«Ά
okay that's the whole page, bestie! remember: data, cb, dcb, allow_multiple (unused!!), buf_size, in exactly that order, and always, always bson_json_reader_destroy() it afterwards. π
β¨
this little love letter came to you from libbson, version 2.5.6, dated Oct 09, 2026 β iykyk π¦πΈ bye bestie!! π
π¦ 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