BSON_VALIDATE_WITH_ERROR(3)
π BSON_VALIDATE_WITH_ERROR(3) β the libbson validation vibe check π
okay bestie, welcome to the libbson manual page for bson_validate_with_error(3). this is the function that gives a BSON document a full vibe check and tells you what's off. no cap. β¨
β¨ SYNOPSIS β¨
bool
bson_validate_with_error (const bson_t *bson,
bson_validate_flags_t flags,
bson_error_t *error);
π PARAMETERS π
bsonβ abson_t. the document getting its little inspection. π¦flagsβ a bitwise-or of all desiredbson_validate_flags_t. mix and match the checks you want. πerrorβ optionalbson_error_t. bring it if you want the details later. π«Ά
π¦ DESCRIPTION π¦
So this function validates a BSON document by walking through the document and inspecting the keys and values for valid content. like, it's doing a whole tour of every key and value, checking that everything is valid. periodt. π
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. slay. Otherwise, returns false, and if error is non-NULL it will be filled out with details. π«Ά
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. π
To get the specific location of the error, use bson_validate_with_error_and_offset() instead. iykyk. π
π SEE ALSO π
bson_validate(),bson_validate_with_error_and_offset().bson_visitor_tcan be used for custom validation, Example Custom Validation. π§
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
π that's the whole page, bestie! this is libbson version2.5.6, datedOct 09, 2026βBSON_VALIDATE_WITH_ERROR(3)signing off. stay iconic and may all your BSON pass validation πβ¨
π¦ 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