MongoDB C++ Driver  mongocxx-3.0.2
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

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

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

Such keys are reserved for MongoDB internal use.

Parameters
check_dollar_keysIf true, keys starting with '$' will be treated as invalid.
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.
void bsoncxx::validator::check_dot_keys ( bool  check_dot_keys)

Verifies that document keys do not contain any '.

' characters. The dot character is illegal in MongoDB keys.

Parameters
check_dollar_keysIf true, keys containing '.' will be treated as invalid.
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.
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.
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.
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.
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.

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