#include <mongocxx/v1/instance.hpp>
An instance of the MongoDB C++ Driver.
All mongocxx API MUST be used within the lifetime of the instance object, with special exemptions listed below. Only ONE instance object may exist for the lifetime of a given process. It is undefined behavior to use the mongocxx API before the instance object is initialized or after the instance object is destroyed. It is undefined behavior to create more than one instance object.
int main() {
{
}
}
An instance of the MongoDB C++ Driver.
Definition instance.hpp:64
instance(instance &&)=delete
This class is not moveable.
- Special exemptions
- Only the following API are permitted to be used outside the lifetime of an instance object:
- See also
-
|
| | instance () |
| | Initialize the mongoc library with unstructured log messages disabled.
|
| | instance (instance &&)=delete |
| | This class is not moveable.
|
| | instance (instance const &)=delete |
| | This class is not copyable.
|
| | instance (std::unique_ptr< v1::logger > handler) |
| | Initialize the mongoc library with the custom unstructured log message handler.
|
| | instance (v1::default_logger tag) |
| | Initialize the mongoc library with its default unstructured log handler.
|
| | ~instance () |
| | Cleanup the mongocxx (and mongoc) library.
|
| instance & | operator= (instance &&)=delete |
| | This class is not moveable.
|
| instance & | operator= (instance const &)=delete |
| | This class is not copyable.
|
◆ errc
Errors codes which may be returned by mongocxx::v1::instance.
| Enumerator |
|---|
| zero | Zero.
|
| multiple_instances | Cannot construct multiple instance objects in a given process.
|
◆ ~instance()
| mongocxx::v1::instance::~instance |
( |
| ) |
|
◆ instance() [1/5]
| mongocxx::v1::instance::instance |
( |
instance && | | ) |
|
|
delete |
This class is not moveable.
◆ instance() [2/5]
| mongocxx::v1::instance::instance |
( |
instance const & | | ) |
|
|
delete |
This class is not copyable.
◆ instance() [3/5]
| mongocxx::v1::instance::instance |
( |
| ) |
|
Initialize the mongoc library with unstructured log messages disabled.
Calls mongoc_init() after disabling unstructured log messages by calling mongoc_log_set_handler(nullptr, nullptr).
- Important
- To use mongoc's default log message handler, construct this object with instance(v1::default_logger tag) instead.
- Exceptions
-
- See also
-
◆ instance() [4/5]
| mongocxx::v1::instance::instance |
( |
std::unique_ptr< v1::logger > | handler | ) |
|
|
explicit |
Initialize the mongoc library with the custom unstructured log message handler.
Calls mongoc_init after registering the custom unstructured log handler by calling mongoc_log_set_handler().
- Parameters
-
| handler | Disable unstructured logging when null. |
- Exceptions
-
Use mongocxx::v1::set_global_logger (or mongocxx::v1::logger_guard) to configure the logger at any time after the instance object has been created.
- See also
-
◆ instance() [5/5]
Initialize the mongoc library with its default unstructured log handler.
Calls mongoc_init without registering any custom unstructured log handler.
- Parameters
-
| tag | Unused: only for overload resolution. |
- Exceptions
-
◆ error_category()
| std::error_category const & mongocxx::v1::instance::error_category |
( |
| ) |
|
|
static |
◆ operator=() [1/2]
This class is not moveable.
◆ operator=() [2/2]
This class is not copyable.
◆ make_error_code
| std::error_code make_error_code |
( |
errc | v | ) |
|
|
friend |
Support implicit conversion to std::error_code.
The documentation for this class was generated from the following file: