GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BSON_VALIDATE_WITH_ERROR(3) libbson BSON_VALIDATE_WITH_ERROR(3)

bool
bson_validate_with_error (const bson_t *bson,

bson_validate_flags_t flags,
bson_error_t *error);


  • bson: A bson_t.
  • flags: A bitwise-or of all desired bson_validate_flags_t.
  • error: Optional bson_error_t.

Validates a BSON document by walking through the document and inspecting the keys and values for valid content.

You can modify how the validation occurs through the use of the flags parameter, see bson_validate_flags_t for details.

If bson passes the requested validations, returns true. 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.

SEE ALSO:

bson_validate(), bson_validate_with_error_and_offset().

bson_visitor_t can be used for custom validation, Example Custom Validation.



MongoDB, Inc

2009-present, MongoDB, Inc.

July 3, 2025 1.30.4

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.