BSON_JSON_OPTS_NEW(3)

bestie, welcome to the BSON_JSON_OPTS_NEW(3) page from the libbson manual πŸ¦‹βœ¨ lowkey it’s a tiny one, but it’s giving β€œallocator main character energy,” and we’re obsessed. It’s all about making a brand-new bson_json_opts_t, no cap. πŸ’…

✨ SYNOPSIS ✨

bson_json_opts_t *
bson_json_opts_new (bson_json_mode_t mode, int32_t max_len);

πŸŽ€ PARAMETERS πŸŽ€

  • mode β€” a bson_json_mode_t, bestie. The encoding-mode of it all.
  • max_len β€” an int32_t. This is the length parameter in question.

πŸ’– DESCRIPTION πŸ’–

okay so the bson_json_opts_new() function shall create a new bson_json_opts_t using the mode and length supplied. The mode member is a bson_json_mode_t defining the encoding mode. Slay. πŸ’…

The max_len member holds a maximum length for the resulting JSON string. Encoding will stop once the serialised string has reached this length β€” literally, it hits the limit and says β€œthat’s it, bestie.” To encode the full BSON document, BSON_MAX_LEN_UNLIMITED can be used. No cap, fr fr. 🌈

🫢 RETURNS 🫢

A newly allocated bson_json_opts_t. That’s the whole return, and honestly? iconic. πŸŽ€

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.

this page is from the libbson source, version 2.5.6, dated Oct 09, 2026 β€” mwah, besties πŸ’‹πŸ’œ

πŸ“¦ where this page comes from