MongoDB C++ Driver
mongocxx-3.7.0
|
Class representing a MongoDB connection string URI. More...
#include <uri.hpp>
Classes | |
struct | host |
A host. More... | |
Public Member Functions | |
uri (bsoncxx::string::view_or_value uri_string=k_default_uri) | |
Constructs a uri from an optional MongoDB URI string. More... | |
uri (uri &&) noexcept | |
Move constructs a uri. | |
uri & | operator= (uri &&) noexcept |
Move assigns a uri. | |
~uri () | |
Destroys a uri. | |
std::string | auth_mechanism () const |
Returns the authentication mechanism from the uri. More... | |
std::string | auth_source () const |
Returns the authentication source from the uri. More... | |
std::vector< host > | hosts () const |
Returns the hosts from the uri. More... | |
std::string | database () const |
Returns the database from the uri. More... | |
bsoncxx::document::view | options () const |
Returns other uri options. More... | |
std::string | password () const |
Returns the password from the uri. More... | |
class read_concern | read_concern () const |
Returns the read concern from the uri. More... | |
class read_preference | read_preference () const |
Returns the read preference from the uri. More... | |
std::string | replica_set () const |
Returns the replica set specified in the uri. More... | |
MONGOCXX_DEPRECATED bool | ssl () const |
Returns the ssl parameter from the uri. More... | |
bool | tls () const |
Returns the tls parameter from the uri. More... | |
std::string | to_string () const |
Returns the uri in a string format. More... | |
std::string | username () const |
Returns the supplied username from the uri. More... | |
class write_concern | write_concern () const |
Returns the write concern specified in the uri. More... | |
stdx::optional< stdx::string_view > | appname () const |
Returns the value of the option "appname" if present in the uri. More... | |
stdx::optional< bsoncxx::document::view > | auth_mechanism_properties () const |
Returns the value of the option "authMechanismProperties" if present in the uri. More... | |
std::vector< stdx::string_view > | compressors () const |
Returns the list of compressors present in the uri or an empty list if "compressors" was not present or contained no valid compressors. More... | |
stdx::optional< std::int32_t > | connect_timeout_ms () const |
Returns the value of the option "connectTimeoutMS" if present in the uri. More... | |
stdx::optional< bool > | direct_connection () const |
Returns the value of the option "directConnection" if present in the uri. More... | |
stdx::optional< std::int32_t > | heartbeat_frequency_ms () const |
Returns the value of the option "heartbeatFrequencyMS" if present in the uri. More... | |
stdx::optional< std::int32_t > | local_threshold_ms () const |
Returns the value of the option "localThresholdMS" if present in the uri. More... | |
stdx::optional< std::int32_t > | max_pool_size () const |
Returns the value of the option "maxPoolSize" if present in the uri. More... | |
stdx::optional< bool > | retry_reads () const |
Returns the value of the option "retryReads" if present in the uri. More... | |
stdx::optional< bool > | retry_writes () const |
Returns the value of the option "retryWrites" if present in the uri. More... | |
stdx::optional< std::int32_t > | server_selection_timeout_ms () const |
Returns the value of the option "serverSelectionTimeoutMS" if present in the uri. More... | |
stdx::optional< bool > | server_selection_try_once () const |
Returns the value of the option "serverSelectionTryOnce" if present in the uri. More... | |
stdx::optional< std::int32_t > | socket_timeout_ms () const |
Returns the value of the option "socketTimeoutMS" if present in the uri. More... | |
stdx::optional< bool > | tls_allow_invalid_certificates () const |
Returns the value of the option "tlsAllowInvalidCertificates" if present in the uri. More... | |
stdx::optional< bool > | tls_allow_invalid_hostnames () const |
Returns the value of the option "tlsAllowInvalidHostnames" if present in the uri. More... | |
stdx::optional< stdx::string_view > | tls_ca_file () const |
Returns the value of the option "tlsCAFile" if present in the uri. More... | |
stdx::optional< stdx::string_view > | tls_certificate_key_file () const |
Returns the value of the option "tlsCertificateKeyFile" if present in the uri. More... | |
stdx::optional< stdx::string_view > | tls_certificate_key_file_password () const |
Returns the value of the option "tlsCertificateKeyFilePassword" if present in the uri. More... | |
stdx::optional< bool > | tls_disable_certificate_revocation_check () const |
Returns the value of the option "tlsDisableCertificateRevocationCheck" if present in the uri. More... | |
stdx::optional< bool > | tls_disable_ocsp_endpoint_check () const |
Returns the value of the option "tlsDisableOCSPEndpointCheck" if present in the uri. More... | |
stdx::optional< bool > | tls_insecure () const |
Returns the value of the option "tlsInsecure" if present in the uri. More... | |
stdx::optional< std::int32_t > | wait_queue_timeout_ms () const |
Returns the value of the option "waitQueueTimeoutMS" if present in the uri. More... | |
stdx::optional< std::int32_t > | zlib_compression_level () const |
Returns the value of the option "zlibCompressionLevel" if present in the uri. More... | |
Class representing a MongoDB connection string URI.
mongocxx::uri::uri | ( | bsoncxx::string::view_or_value | uri_string = k_default_uri | ) |
Constructs a uri from an optional MongoDB URI string.
If no URI string is specified, uses the default URI string, 'mongodb://localhost:27017'.
uri_string | String representing a MongoDB connection string URI, defaults to k_default_uri. |
stdx::optional<stdx::string_view> mongocxx::uri::appname | ( | ) | const |
Returns the value of the option "appname" if present in the uri.
std::string mongocxx::uri::auth_mechanism | ( | ) | const |
Returns the authentication mechanism from the uri.
stdx::optional<bsoncxx::document::view> mongocxx::uri::auth_mechanism_properties | ( | ) | const |
Returns the value of the option "authMechanismProperties" if present in the uri.
std::string mongocxx::uri::auth_source | ( | ) | const |
Returns the authentication source from the uri.
std::vector<stdx::string_view> mongocxx::uri::compressors | ( | ) | const |
Returns the list of compressors present in the uri or an empty list if "compressors" was not present or contained no valid compressors.
stdx::optional<std::int32_t> mongocxx::uri::connect_timeout_ms | ( | ) | const |
Returns the value of the option "connectTimeoutMS" if present in the uri.
std::string mongocxx::uri::database | ( | ) | const |
Returns the database from the uri.
stdx::optional<bool> mongocxx::uri::direct_connection | ( | ) | const |
Returns the value of the option "directConnection" if present in the uri.
stdx::optional<std::int32_t> mongocxx::uri::heartbeat_frequency_ms | ( | ) | const |
Returns the value of the option "heartbeatFrequencyMS" if present in the uri.
std::vector<host> mongocxx::uri::hosts | ( | ) | const |
Returns the hosts from the uri.
stdx::optional<std::int32_t> mongocxx::uri::local_threshold_ms | ( | ) | const |
Returns the value of the option "localThresholdMS" if present in the uri.
stdx::optional<std::int32_t> mongocxx::uri::max_pool_size | ( | ) | const |
Returns the value of the option "maxPoolSize" if present in the uri.
bsoncxx::document::view mongocxx::uri::options | ( | ) | const |
Returns other uri options.
Note, options are returned in the case they were presented. The URI mongodb://localhost/?appName=abc will return { "appName": "abc" } The URI mongodb://localhost/?appname=abc will return { "appname": "abc" }
std::string mongocxx::uri::password | ( | ) | const |
Returns the password from the uri.
class read_concern mongocxx::uri::read_concern | ( | ) | const |
Returns the read concern from the uri.
class read_preference mongocxx::uri::read_preference | ( | ) | const |
Returns the read preference from the uri.
std::string mongocxx::uri::replica_set | ( | ) | const |
Returns the replica set specified in the uri.
stdx::optional<bool> mongocxx::uri::retry_reads | ( | ) | const |
Returns the value of the option "retryReads" if present in the uri.
stdx::optional<bool> mongocxx::uri::retry_writes | ( | ) | const |
Returns the value of the option "retryWrites" if present in the uri.
stdx::optional<std::int32_t> mongocxx::uri::server_selection_timeout_ms | ( | ) | const |
Returns the value of the option "serverSelectionTimeoutMS" if present in the uri.
stdx::optional<bool> mongocxx::uri::server_selection_try_once | ( | ) | const |
Returns the value of the option "serverSelectionTryOnce" if present in the uri.
stdx::optional<std::int32_t> mongocxx::uri::socket_timeout_ms | ( | ) | const |
Returns the value of the option "socketTimeoutMS" if present in the uri.
MONGOCXX_DEPRECATED bool mongocxx::uri::ssl | ( | ) | const |
Returns the ssl parameter from the uri.
true
if ssl is enabled and false
if not.bool mongocxx::uri::tls | ( | ) | const |
Returns the tls parameter from the uri.
true
if tls is enabled and false
if not. stdx::optional<bool> mongocxx::uri::tls_allow_invalid_certificates | ( | ) | const |
Returns the value of the option "tlsAllowInvalidCertificates" if present in the uri.
stdx::optional<bool> mongocxx::uri::tls_allow_invalid_hostnames | ( | ) | const |
Returns the value of the option "tlsAllowInvalidHostnames" if present in the uri.
stdx::optional<stdx::string_view> mongocxx::uri::tls_ca_file | ( | ) | const |
Returns the value of the option "tlsCAFile" if present in the uri.
stdx::optional<stdx::string_view> mongocxx::uri::tls_certificate_key_file | ( | ) | const |
Returns the value of the option "tlsCertificateKeyFile" if present in the uri.
stdx::optional<stdx::string_view> mongocxx::uri::tls_certificate_key_file_password | ( | ) | const |
Returns the value of the option "tlsCertificateKeyFilePassword" if present in the uri.
stdx::optional<bool> mongocxx::uri::tls_disable_certificate_revocation_check | ( | ) | const |
Returns the value of the option "tlsDisableCertificateRevocationCheck" if present in the uri.
stdx::optional<bool> mongocxx::uri::tls_disable_ocsp_endpoint_check | ( | ) | const |
Returns the value of the option "tlsDisableOCSPEndpointCheck" if present in the uri.
stdx::optional<bool> mongocxx::uri::tls_insecure | ( | ) | const |
Returns the value of the option "tlsInsecure" if present in the uri.
std::string mongocxx::uri::to_string | ( | ) | const |
Returns the uri in a string format.
std::string mongocxx::uri::username | ( | ) | const |
Returns the supplied username from the uri.
stdx::optional<std::int32_t> mongocxx::uri::wait_queue_timeout_ms | ( | ) | const |
Returns the value of the option "waitQueueTimeoutMS" if present in the uri.
class write_concern mongocxx::uri::write_concern | ( | ) | const |
Returns the write concern specified in the uri.
stdx::optional<std::int32_t> mongocxx::uri::zlib_compression_level | ( | ) | const |
Returns the value of the option "zlibCompressionLevel" if present in the uri.