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_FLAGS_T(3) libbson BSON_VALIDATE_FLAGS_T(3)

Document validation options

#include <bson/bson-types.h>
typedef enum {

BSON_VALIDATE_NONE = 0,
BSON_VALIDATE_UTF8 = (1 << 0),
BSON_VALIDATE_DOLLAR_KEYS = (1 << 1),
BSON_VALIDATE_DOT_KEYS = (1 << 2),
BSON_VALIDATE_UTF8_ALLOW_NULL = (1 << 3),
BSON_VALIDATE_EMPTY_KEYS = (1 << 4), } bson_validate_flags_t;


bson_validate_flags_t is a set of binary flags which may be combined to specify a level of BSON document validation.

A value of 0, false, or BSON_VALIDATE_NONE equivalently requests the minimum applicable level of validation.

In the context of validation APIs bson_validate(), bson_validate_with_error(), and bson_validate_with_error_and_offset() the minimum validation still guarantees that a document can be successfully traversed by bson_iter_visit_all().

Higher level APIs using this type may have different minimum validation levels. For example, libmongoc functions that take bson_validate_flags_t use 0 to mean the document contents are not visited and malformed headers will not be detected by the client.

Each defined flag aside from BSON_VALIDATE_NONE describes an optional validation feature that may be enabled, alone or in combination with other features:

  • BSON_VALIDATE_NONE Minimum level of validation; in libbson, validates element headers.
  • BSON_VALIDATE_UTF8 All keys and string values are checked for invalid UTF-8.
  • BSON_VALIDATE_UTF8_ALLOW_NULL String values are allowed to have embedded NULL bytes.
  • BSON_VALIDATE_DOLLAR_KEYS Prohibit keys that start with $ outside of a "DBRef" subdocument.
  • BSON_VALIDATE_DOT_KEYS Prohibit keys that contain . anywhere in the string.
  • BSON_VALIDATE_EMPTY_KEYS Prohibit zero-length keys.

SEE ALSO:

bson_validate(), bson_validate_with_error(), 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.