MongoDB C++ Driver
mongocxx-3.7.0
|
Top level namespace for MongoDB C++ BSON functionality. More...
Classes | |
class | decimal128 |
Represents an IEEE 754-2008 BSON Decimal128 value in a platform-independent way. More... | |
class | exception |
Class representing any exceptions emitted from the bsoncxx library or its underlying implementation. More... | |
class | oid |
Represents a MongoDB ObjectId. More... | |
class | validator |
A validator is used to enable or disable specific checks that can be performed during BSON validation. More... | |
class | view_or_value |
Class representing a view-or-value variant type. More... | |
Functions | |
const std::error_category & | error_category () |
Get the error_category for exceptions originating from the bsoncxx library. More... | |
std::error_code | make_error_code (error_code error) |
Translate a bsoncxx::error_code into a std::error_code. More... | |
std::string | to_json (document::view view, ExtendedJsonMode mode=ExtendedJsonMode::k_legacy) |
Converts a BSON document to a JSON string, in extended format. More... | |
document::value | from_json (stdx::string_view json) |
Constructs a new document::value from the provided JSON text. More... | |
document::value | operator""_bson (const char *json, size_t len) |
Constructs a new document::value from the provided JSON text. More... | |
std::string | to_string (type rhs) |
Returns a stringification of the given type. More... | |
std::string | to_string (binary_sub_type rhs) |
Returns a stringification of the given binary sub type. More... | |
stdx::optional< document::view > | validate (const std::uint8_t *data, std::size_t length) |
Validates a BSON document. More... | |
stdx::optional< document::view > | validate (const std::uint8_t *data, std::size_t length, const validator &validator, std::size_t *invalid_offset=nullptr) |
Validates a BSON document. More... | |
Top level namespace for MongoDB C++ BSON functionality.
|
strong |
An enumeration of each BSON binary sub type.
These x-macros will expand to be of the form: k_binary = 0x00, k_function = 0x01, k_binary_deprecated = 0x02, k_uuid_deprecated = 0x03, k_uuid = 0x04, k_md5 = 0x05, k_encrypted = 0x06, k_column = 0x07, k_user = 0x80
|
strong |
Enum representing the various error types that can occur while operating on BSON values.
|
strong |
|
strong |
An enumeration of each BSON type.
These x-macros will expand to be of the form: k_double = 0x01, k_string = 0x02, k_document = 0x03, k_array = 0x04 ...
const std::error_category& bsoncxx::error_category | ( | ) |
Get the error_category for exceptions originating from the bsoncxx library.
document::value bsoncxx::from_json | ( | stdx::string_view | json | ) |
Constructs a new document::value from the provided JSON text.
'json' | A string_view into a JSON document. |
bsoncxx::exception | with error details if the conversion failed. |
std::error_code bsoncxx::make_error_code | ( | error_code | error | ) |
Translate a bsoncxx::error_code into a std::error_code.
error | An error from bsoncxx |
document::value bsoncxx::operator""_bson | ( | const char * | json, |
size_t | len | ||
) |
Constructs a new document::value from the provided JSON text.
This is the UDL version of from_json().
'json' | A string into a JSON document. |
'len' | The length of the JSON string. This is calculated automatically upon use of the UDL. |
bsoncxx::exception | with error details if the conversion failed. |
std::string bsoncxx::to_json | ( | document::view | view, |
ExtendedJsonMode | mode = ExtendedJsonMode::k_legacy |
||
) |
Converts a BSON document to a JSON string, in extended format.
view | A valid BSON document. |
mode | An optional JSON representation mode. |
bsoncxx::exception | with error details if the conversion failed. |
std::string bsoncxx::to_string | ( | binary_sub_type | rhs | ) |
Returns a stringification of the given binary sub type.
rhs | The type to stringify. |
std::string bsoncxx::to_string | ( | type | rhs | ) |
Returns a stringification of the given type.
rhs | The type to stringify. |
stdx::optional<document::view> bsoncxx::validate | ( | const std::uint8_t * | data, |
std::size_t | length | ||
) |
Validates a BSON document.
This is a simplified overload that will only do the bare minimum validation of document structure, and does not provide any further information if the document is found to be invalid.
data | A buffer containing a BSON document to validate. |
length | The size of the buffer. |
stdx::optional<document::view> bsoncxx::validate | ( | const std::uint8_t * | data, |
std::size_t | length, | ||
const validator & | validator, | ||
std::size_t * | invalid_offset = nullptr |
||
) |
Validates a BSON document.
This overload provides additional control over the precise validation that is performed, and will give the caller access to the offset at which the document was found to be invalid.
data | A buffer containing a BSON document to validate. |
length | The size of the buffer. |
validator | A validator used to configure what checks are done. If validation fails, it will contain the offset at which the document was found to be invalid. |
invalid_offset | If validation fails, the offset at which the document was found to be invalid will be stored here (if non-null). |