MongoDB C++ Driver  mongocxx-3.7.0
Public Member Functions | List of all members
bsoncxx::validator Class Reference

A validator is used to enable or disable specific checks that can be performed during BSON validation. More...

#include <validate.hpp>

Public Member Functions

 validator ()
 Constructs a validator.
 
 ~validator ()
 Destructs a validator.
 
void check_utf8 (bool check_utf8)
 Verify that all keys and string values are valid UTF-8. More...
 
bool check_utf8 () const
 Getter for the current check_utf8 value of the underlying validator. More...
 
void check_utf8_allow_null (bool check_utf8_allow_null)
 Verify that all keys and string values are valid UTF-8, but allow null bytes. More...
 
bool check_utf8_allow_null () const
 Getter for the current check_utf8_allow_null value of the underlying validator. More...
 
void check_dollar_keys (bool check_dollar_keys)
 Verifies that document keys are not preceeded with '$'. More...
 
bool check_dollar_keys () const
 Getter for the current check_dollar_keys value of the underlying validator. More...
 
void check_dot_keys (bool check_dot_keys)
 Verifies that document keys do not contain any '. More...
 
bool check_dot_keys () const
 Getter for the current check_dot_keys value of the underlying validator. More...
 

Detailed Description

A validator is used to enable or disable specific checks that can be performed during BSON validation.

Member Function Documentation

◆ check_dollar_keys() [1/2]

bool bsoncxx::validator::check_dollar_keys ( ) const

Getter for the current check_dollar_keys value of the underlying validator.

Returns
True if keys starting with '$' will be treated as invalid.

◆ check_dollar_keys() [2/2]

void bsoncxx::validator::check_dollar_keys ( bool  check_dollar_keys)

Verifies that document keys are not preceeded with '$'.

Parameters
check_dollar_keysIf true, keys starting with '$' will be treated as invalid.

◆ check_dot_keys() [1/2]

bool bsoncxx::validator::check_dot_keys ( ) const

Getter for the current check_dot_keys value of the underlying validator.

Returns
True if keys containing '.' will be treated as invalid.

◆ check_dot_keys() [2/2]

void bsoncxx::validator::check_dot_keys ( bool  check_dot_keys)

Verifies that document keys do not contain any '.

' characters.

Parameters
check_dot_keysIf true, keys containing '.' will be treated as invalid.

◆ check_utf8() [1/2]

bool bsoncxx::validator::check_utf8 ( ) const

Getter for the current check_utf8 value of the underlying validator.

Returns
True if UTF-8 validation is performed.

◆ check_utf8() [2/2]

void bsoncxx::validator::check_utf8 ( bool  check_utf8)

Verify that all keys and string values are valid UTF-8.

Parameters
check_utf8If true, UTF-8 validation is performed.

◆ check_utf8_allow_null() [1/2]

bool bsoncxx::validator::check_utf8_allow_null ( ) const

Getter for the current check_utf8_allow_null value of the underlying validator.

Returns
True if UTF-8 validation (with null bytes allowed) is performed.

◆ check_utf8_allow_null() [2/2]

void bsoncxx::validator::check_utf8_allow_null ( bool  check_utf8_allow_null)

Verify that all keys and string values are valid UTF-8, but allow null bytes.

This is generally bad practice, but some languages such as Python, can sennd UTF-8 encoded strings with null bytes.

Parameters
check_utf8_allow_nullIf true, UTF-8 validation (with null bytes allowed) is performed.

The documentation for this class was generated from the following file: