Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
BSON_VALIDATE_FLAGS_T(3)	     libbson		BSON_VALIDATE_FLAGS_T(3)

Document validation options

SYNOPSIS
	#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_CORRUPT = (1 << 5),
	} bson_validate_flags_t;

DESCRIPTION
     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  mini-
     mum 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 vali-
     dation feature that may be enabled, alone or in combination with other fea-
     tures:

     * BSON_VALIDATE_NONE Minimum level of validation; in libbson, validates el-
       ement 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.

     * BSON_VALIDATE_CORRUPT is not a control flag, but is used as an error code
       when a validation routine encounters corrupt BSON data.

     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.

AUTHOR
     MongoDB, Inc

COPYRIGHT
     2009-present, MongoDB, Inc.

1.30.8				  Aug 27, 2026		BSON_VALIDATE_FLAGS_T(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=bson_validate_flags_t&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help