MongoDB C++ Driver  legacy-1.1.2
Public Types | Public Member Functions | Static Public Member Functions | List of all members
mongo::client::Options Class Reference

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...
 
OptionssetCallShutdownAtExit (bool value=true)
 If true, the driver will automatically schedule a client::shutdown via 'std::atexit'. More...
 
OptionssetAutoShutdownGracePeriodMillis (unsigned int millis)
 The grace period used when calling client::shutdown from atexit. More...
 
OptionssetDefaultLocalThresholdMillis (int millis)
 Set the default threshold to consider a node local. More...
 
OptionssetSSLMode (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...
 
OptionssetFIPSMode (bool value=true)
 Sets whether to operate in FIPS mode. More...
 
OptionssetSSLDisabledTLSProtocols (const std::vector< TLSProtocol > &protocols)
 Allow disabling particular TLS protocols. More...
 
OptionssetSSLCAFile (const std::string &fileName)
 Configure the SSL CA file to use. More...
 
OptionssetSSLPEMKeyFile (const std::string &fileName)
 Configure the SSL PEM key file to use. More...
 
OptionssetSSLPEMKeyPassword (const std::string &password)
 Configure the SSL PEM key password. More...
 
OptionssetSSLCRLFile (const std::string &fileName)
 Configure the SSL CRL file to use. More...
 
OptionssetSSLAllowInvalidCertificates (bool value=true)
 When set true, SSL certificate validation is disabled. More...
 
OptionssetSSLAllowInvalidHostnames (bool value=true)
 When set true, SSL hostname validation is disabled. More...
 
OptionssetSSLCipherConfig (const std::string &config)
 Override the default OpenSSL cipher configuration. More...
 
OptionssetLogAppenderFactory (const LogAppenderFactory &factory)
 Provide a factory for a log appender to configure logging. More...
 
OptionssetMinLoggedSeverity (logger::LogSeverity level)
 Specify the minimum severity of messages that will be logged, if logging is enabled. More...
 
OptionssetIPv6Enabled (bool state)
 Enable support for the IPv6 protocol family. More...
 
OptionssetValidateObjects (bool value=true)
 Configure whether BSON objects returned from the server should be validated. More...
 

Static Public Member Functions

static const Optionscurrent ()
 Obtains the currently configured options for the driver. More...
 

Detailed Description

The Options structure is passed to mongo::client::initialize to configure various properties and configurations of the driver.

Member Enumeration Documentation

The possible modes for SSL support in an SSL enabled build of the driver.

Enumerator
kSSLDisabled 

Don't attempt to make SSL connections, or require SSL support of the server.

kSSLRequired 

Attempt SSL connections, but fall back to no SSL if server does not support.

NOTE: The driver does not currently offer this mode.Require SLL.

Constructor & Destructor Documentation

mongo::client::Options::Options ( )

Constructs a default options object with default values for all options.

The default option values are documented with each mutator.

Member Function Documentation

static const Options& mongo::client::Options::current ( )
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

bool mongo::client::Options::SSLEnabled ( ) const
inline

A convenience: returns true if SSL is not disabled (preferred or required).


The documentation for this class was generated from the following file: