MongoDB C++ Driver
legacy-1.1.2
|
The Options structure is passed to mongo::client::initialize to configure various properties and configurations of the driver. More...
#include <options.h>
Public Types | |
enum | DefaultPorts |
The default ports where different mongodb servers tend to run. | |
enum | SSLModes { kSSLDisabled, kSSLRequired } |
The possible modes for SSL support in an SSL enabled build of the driver. More... | |
enum | TLSProtocol |
The TLS protocols. | |
Public Member Functions | |
Options () | |
Constructs a default options object with default values for all options. More... | |
Options & | setCallShutdownAtExit (bool value=true) |
If true, the driver will automatically schedule a client::shutdown via 'std::atexit'. More... | |
Options & | setAutoShutdownGracePeriodMillis (unsigned int millis) |
The grace period used when calling client::shutdown from atexit. More... | |
Options & | setDefaultLocalThresholdMillis (int millis) |
Set the default threshold to consider a node local. More... | |
Options & | setSSLMode (SSLModes sslMode=kSSLRequired) |
If set to kSSLRequired, the driver will use SSL when connecting. More... | |
bool | SSLEnabled () const |
A convenience: returns true if SSL is not disabled (preferred or required). More... | |
Options & | setFIPSMode (bool value=true) |
Sets whether to operate in FIPS mode. More... | |
Options & | setSSLDisabledTLSProtocols (const std::vector< TLSProtocol > &protocols) |
Allow disabling particular TLS protocols. More... | |
Options & | setSSLCAFile (const std::string &fileName) |
Configure the SSL CA file to use. More... | |
Options & | setSSLPEMKeyFile (const std::string &fileName) |
Configure the SSL PEM key file to use. More... | |
Options & | setSSLPEMKeyPassword (const std::string &password) |
Configure the SSL PEM key password. More... | |
Options & | setSSLCRLFile (const std::string &fileName) |
Configure the SSL CRL file to use. More... | |
Options & | setSSLAllowInvalidCertificates (bool value=true) |
When set true, SSL certificate validation is disabled. More... | |
Options & | setSSLAllowInvalidHostnames (bool value=true) |
When set true, SSL hostname validation is disabled. More... | |
Options & | setSSLCipherConfig (const std::string &config) |
Override the default OpenSSL cipher configuration. More... | |
Options & | setLogAppenderFactory (const LogAppenderFactory &factory) |
Provide a factory for a log appender to configure logging. More... | |
Options & | setMinLoggedSeverity (logger::LogSeverity level) |
Specify the minimum severity of messages that will be logged, if logging is enabled. More... | |
Options & | setIPv6Enabled (bool state) |
Enable support for the IPv6 protocol family. More... | |
Options & | setValidateObjects (bool value=true) |
Configure whether BSON objects returned from the server should be validated. More... | |
Static Public Member Functions | |
static const Options & | current () |
Obtains the currently configured options for the driver. More... | |
The Options structure is passed to mongo::client::initialize to configure various properties and configurations of the driver.
The possible modes for SSL support in an SSL enabled build of the driver.
mongo::client::Options::Options | ( | ) |
Constructs a default options object with default values for all options.
The default option values are documented with each mutator.
|
static |
Obtains the currently configured options for the driver.
This method must not be called before mongo::client::initialize has completed.
Options& mongo::client::Options::setAutoShutdownGracePeriodMillis | ( | unsigned int | millis | ) |
The grace period used when calling client::shutdown from atexit.
If 'callShutdownAtExit' is false, this parameter has no effect.
Default: 0 ms (wait forever).
Options& mongo::client::Options::setCallShutdownAtExit | ( | bool | value = true | ) |
If true, the driver will automatically schedule a client::shutdown via 'std::atexit'.
If false, the user of the library is responsible for calling 'client::shutdown'. Not all platforms support this option (notably, the Windows DLL build of the driver does not), so the default value of this parameter is 'false'. If this parameter is set to 'true' and the platform cannot honor the request to enable 'atexit' termination, 'mongo::client::initialize' will return a non-OK status.
Default: false
Options& mongo::client::Options::setDefaultLocalThresholdMillis | ( | int | millis | ) |
Set the default threshold to consider a node local.
Default: 15 ms
Options& mongo::client::Options::setFIPSMode | ( | bool | value = true | ) |
Sets whether to operate in FIPS mode.
Default: false
Options& mongo::client::Options::setIPv6Enabled | ( | bool | state | ) |
Enable support for the IPv6 protocol family.
Default: false
Options& mongo::client::Options::setLogAppenderFactory | ( | const LogAppenderFactory & | factory | ) |
Provide a factory for a log appender to configure logging.
Default: no log appender, and logging is not enabled.
Options& mongo::client::Options::setMinLoggedSeverity | ( | logger::LogSeverity | level | ) |
Specify the minimum severity of messages that will be logged, if logging is enabled.
Default: LogSeverity::Log()
Options& mongo::client::Options::setSSLAllowInvalidCertificates | ( | bool | value = true | ) |
When set true, SSL certificate validation is disabled.
Default: false
Options& mongo::client::Options::setSSLAllowInvalidHostnames | ( | bool | value = true | ) |
When set true, SSL hostname validation is disabled.
Default: false
Options& mongo::client::Options::setSSLCAFile | ( | const std::string & | fileName | ) |
Configure the SSL CA file to use.
Has no effect if 'useSSL' is false.
Default: false
Options& mongo::client::Options::setSSLCipherConfig | ( | const std::string & | config | ) |
Override the default OpenSSL cipher configuration.
Default: OpenSSL default
Options& mongo::client::Options::setSSLCRLFile | ( | const std::string & | fileName | ) |
Configure the SSL CRL file to use.
Has no effect if 'useSSL' is false.
Default: <empty>
Options& mongo::client::Options::setSSLDisabledTLSProtocols | ( | const std::vector< TLSProtocol > & | protocols | ) |
Allow disabling particular TLS protocols.
Default: OpenSSL default
Options& mongo::client::Options::setSSLMode | ( | SSLModes | sslMode = kSSLRequired | ) |
If set to kSSLRequired, the driver will use SSL when connecting.
Default: kSSLDisabled
Options& mongo::client::Options::setSSLPEMKeyFile | ( | const std::string & | fileName | ) |
Configure the SSL PEM key file to use.
Has no effect if 'useSSL' is false.
Default: <empty>
Options& mongo::client::Options::setSSLPEMKeyPassword | ( | const std::string & | password | ) |
Configure the SSL PEM key password.
Has no effect if 'useSSL' is false.
Default: <empty>
Options& mongo::client::Options::setValidateObjects | ( | bool | value = true | ) |
Configure whether BSON objects returned from the server should be validated.
Default: false
|
inline |
A convenience: returns true if SSL is not disabled (preferred or required).