BSON_VALIDATE_...RROR_AND_OFFSET(3)
π BSON_VALIDATE_...RROR_AND_OFFSET(3) π
okay bestie, welcome to the libbson manual π this page is all about bson_validate_with_error_and_offset β yes the name is a whole mouthful, but she's iconic for it. let's get into it.
β¨ SYNOPSIS β¨
bool
bson_validate_with_error_and_offset (const bson_t *bson,
bson_validate_flags_t flags,
size_t *offset,
bson_error_t *error)
π PARAMETERS π
bsonβ abson_t. the document getting the vibe check.flagsβ a bitwise-or of all desiredbson_validate_flags_t. like, mix and match your validation wishes.offsetβ optional location where the error offset will be written. optional, so no pressure.errorβ optionalbson_error_t. also optional, but lowkey helpful when things go sideways.
π¦ DESCRIPTION π¦
Validates a BSON document by walking through the document and inspecting the keys and values for valid content. she literally goes key by key, value by value, checking that everything is valid. it's giving thorough.
You can modify how the validation occurs through the use of the flags parameter, see bson_validate_flags_t for details.
πΈ RETURNS πΈ
If bson passes the requested validations, returns true. otherwise, returns false and writes each non-NULL output parameter: offset with the byte offset of the detected error and error with the details. no cap, it tells you where and why.
The bson_error_t domain is set to BSON_ERROR_INVALID. its code is set to one of the bson_validate_flags_t flags indicating which validation failed; for example, if a key contains invalid UTF-8, then the code is set to BSON_VALIDATE_UTF8, but if the basic structure of the BSON document is corrupt, the code is set to BSON_VALIDATE_NONE. The error message is filled out, and gives more detail if possible.
π SEE ALSO π
bson_validate(),bson_validate_with_error().bson_visitor_tcan be used for custom validation, Example Custom Validation.
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
okay bye bestie! this libbson page is version 2.5.6, and the footer date is Oct 09, 20BSON_VALIDATE_...RROR_AND_OFFSET(3) β the margin really ate, but the receipts are kept πβ¨ periodt.
π¦ 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