#include <mongocxx/v1/client.hpp>
A connection to a MongoDB deployment.
Classes | |
| class | options |
| Options for mongocxx::v1::client. More... | |
Public Types | |
| enum class | errc |
| Errors codes which may be returned by mongocxx::v1::client. More... | |
Public Member Functions | |
| client () | |
| Default initialization. | |
| client (client &&other) noexcept | |
| Move constructor. | |
| client (client const &other)=delete | |
| This class is not copyable. | |
| ~client () | |
| Destroy this object. | |
| v1::database | database (bsoncxx::v1::stdx::string_view name) |
| Access the database with the given name. | |
| operator bool () const | |
| Return true when *this is NOT in an assign-or-destroy-only state. | |
| client & | operator= (client &&other) noexcept |
| Move assignment. | |
| client & | operator= (client const &other)=delete |
| This class is not copyable. | |
| v1::database | operator[] (bsoncxx::v1::stdx::string_view name) |
| Equivalent to this->database(name). | |
| void | reset () |
| Invalidate this client object without invaliding existing cursors or sessions. | |
| v1::uri | uri () const |
| Return the mongocxx::v1::uri used to initialize this client. | |
| client (v1::uri uri, options opts) | |
| Initialize with the given URI. | |
| client (v1::uri uri) | |
| Initialize with the given URI. | |
| v1::cursor | list_databases () |
| Return an unsorted list of all existing databases. | |
| v1::cursor | list_databases (v1::client_session const &session) |
| Return an unsorted list of all existing databases. | |
| v1::cursor | list_databases (bsoncxx::v1::document::view opts) |
| Return an unsorted list of all existing databases. | |
| v1::cursor | list_databases (v1::client_session const &session, bsoncxx::v1::document::view opts) |
| Return an unsorted list of all existing databases. | |
| std::vector< std::string > | list_database_names (bsoncxx::v1::document::view filter) |
| Return an unsorted list of the names of all existing databases. | |
| std::vector< std::string > | list_database_names (v1::client_session const &session, bsoncxx::v1::document::view filter) |
| Return an unsorted list of the names of all existing databases. | |
| std::vector< std::string > | list_database_names () |
| Return an unsorted list of the names of all existing databases. | |
| std::vector< std::string > | list_database_names (v1::client_session const &session) |
| Return an unsorted list of the names of all existing databases. | |
| v1::client_session | start_session (v1::client_session::options const &opts) |
| Create a new client session to use with subsequent operations. | |
| v1::client_session | start_session () |
| Create a new client session to use with subsequent operations. | |
| v1::change_stream | watch (v1::change_stream::options const &opts) |
| Return a change stream subscribed to this connection. | |
| v1::change_stream | watch () |
| Return a change stream subscribed to this connection. | |
| v1::change_stream | watch (v1::client_session const &session, v1::change_stream::options const &opts) |
| Return a change stream subscribed to this connection. | |
| v1::change_stream | watch (v1::client_session const &session) |
| Return a change stream subscribed to this connection. | |
| v1::change_stream | watch (v1::pipeline const &pipeline, v1::change_stream::options const &opts) |
| Return a change stream subscribed to this connection with events filtered/modified by pipeline. | |
| v1::change_stream | watch (v1::client_session const &session, v1::pipeline const &pipeline, v1::change_stream::options const &opts) |
| Return a change stream subscribed to this connection with events filtered/modified by pipeline. | |
| v1::change_stream | watch (v1::pipeline const &pipeline) |
| Return a change stream subscribed to this connection with events filtered/modified by pipeline. | |
| v1::change_stream | watch (v1::client_session const &session, v1::pipeline const &pipeline) |
| Return a change stream subscribed to this connection with events filtered/modified by pipeline. | |
Static Public Member Functions | |
| static std::error_category const & | error_category () |
| The error category for mongocxx::v1::client::errc. | |
Friends | |
| std::error_code | make_error_code (errc v) |
| Support implicit conversion to std::error_code. | |
|
strong |
Errors codes which may be returned by mongocxx::v1::client.
| Enumerator | |
|---|---|
| zero | Zero. |
| tls_not_enabled | TLS is not enabled by URI options. |
| tls_not_supported | TLS is not supported by the mongoc library. |
| mongocxx::v1::client::~client | ( | ) |
Destroy this object.
|
noexcept |
Move constructor.
|
delete |
This class is not copyable.
Initialize with the given URI.
| mongocxx::v1::exception | when a client-side error is encountered. |
| mongocxx::v1::client::client | ( | v1::uri | uri | ) |
Initialize with the given URI.
| mongocxx::v1::exception | when a client-side error is encountered. |
| mongocxx::v1::client::client | ( | ) |
Default initialization.
| v1::database mongocxx::v1::client::database | ( | bsoncxx::v1::stdx::string_view | name | ) |
Access the database with the given name.
|
static |
The error category for mongocxx::v1::client::errc.
| std::vector< std::string > mongocxx::v1::client::list_database_names | ( | ) |
Return an unsorted list of the names of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| std::vector< std::string > mongocxx::v1::client::list_database_names | ( | bsoncxx::v1::document::view | filter | ) |
Return an unsorted list of the names of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| std::vector< std::string > mongocxx::v1::client::list_database_names | ( | v1::client_session const & | session | ) |
Return an unsorted list of the names of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| std::vector< std::string > mongocxx::v1::client::list_database_names | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | filter ) |
Return an unsorted list of the names of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::client::list_databases | ( | ) |
Return an unsorted list of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::client::list_databases | ( | bsoncxx::v1::document::view | opts | ) |
Return an unsorted list of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::client::list_databases | ( | v1::client_session const & | session | ) |
Return an unsorted list of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::cursor mongocxx::v1::client::list_databases | ( | v1::client_session const & | session, |
| bsoncxx::v1::document::view | opts ) |
Return an unsorted list of all existing databases.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
|
explicit |
Return true when *this is NOT in an assign-or-destroy-only state.
Move assignment.
| v1::database mongocxx::v1::client::operator[] | ( | bsoncxx::v1::stdx::string_view | name | ) |
Equivalent to this->database(name).
| void mongocxx::v1::client::reset | ( | ) |
Invalidate this client object without invaliding existing cursors or sessions.
This function must be invoked by a (forked) child process to prevent its destruction within the child process from invalidating the state of the client object within the parent process.
| v1::client_session mongocxx::v1::client::start_session | ( | ) |
Create a new client session to use with subsequent operations.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::client_session mongocxx::v1::client::start_session | ( | v1::client_session::options const & | opts | ) |
Create a new client session to use with subsequent operations.
| mongocxx::v1::server_error | when a server-side error is encountered and a raw server error is available. |
| mongocxx::v1::exception | for all other runtime errors. |
| v1::uri mongocxx::v1::client::uri | ( | ) | const |
Return the mongocxx::v1::uri used to initialize this client.
| v1::change_stream mongocxx::v1::client::watch | ( | ) |
Return a change stream subscribed to this connection.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::change_stream::options const & | opts | ) |
Return a change stream subscribed to this connection.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::client_session const & | session | ) |
Return a change stream subscribed to this connection.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::client_session const & | session, |
| v1::change_stream::options const & | opts ) |
Return a change stream subscribed to this connection.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::client_session const & | session, |
| v1::pipeline const & | pipeline ) |
Return a change stream subscribed to this connection with events filtered/modified by pipeline.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::client_session const & | session, |
| v1::pipeline const & | pipeline, | ||
| v1::change_stream::options const & | opts ) |
Return a change stream subscribed to this connection with events filtered/modified by pipeline.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::pipeline const & | pipeline | ) |
Return a change stream subscribed to this connection with events filtered/modified by pipeline.
| v1::change_stream mongocxx::v1::client::watch | ( | v1::pipeline const & | pipeline, |
| v1::change_stream::options const & | opts ) |
Return a change stream subscribed to this connection with events filtered/modified by pipeline.
|
friend |
Support implicit conversion to std::error_code.