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

Static Public Member Functions

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

Detailed Description

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

Member Enumeration Documentation

◆ SSLModes

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

◆ Options()

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

◆ current()

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.

◆ setAutoShutdownGracePeriodMillis()

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).

◆ setCallShutdownAtExit()

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

◆ setDefaultLocalThresholdMillis()

Options & mongo::client::Options::setDefaultLocalThresholdMillis ( int  millis)

Set the default threshold to consider a node local.

Default: 15 ms

◆ setFIPSMode()

Options & mongo::client::Options::setFIPSMode ( bool  value = true)

Sets whether to operate in FIPS mode.

Default: false

◆ setIPv6Enabled()

Options & mongo::client::Options::setIPv6Enabled ( bool  state)

Enable support for the IPv6 protocol family.

Default: false

◆ setLogAppenderFactory()

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.

◆ setMinLoggedSeverity()

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()

◆ setSSLAllowInvalidCertificates()

Options & mongo::client::Options::setSSLAllowInvalidCertificates ( bool  value = true)

When set true, SSL certificate validation is disabled.

Default: false

◆ setSSLAllowInvalidHostnames()

Options & mongo::client::Options::setSSLAllowInvalidHostnames ( bool  value = true)

When set true, SSL hostname validation is disabled.

Default: false

◆ setSSLCAFile()

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

◆ setSSLCipherConfig()

Options & mongo::client::Options::setSSLCipherConfig ( const std::string &  config)

Override the default OpenSSL cipher configuration.

Default: OpenSSL default

◆ setSSLCRLFile()

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>

◆ setSSLDisabledTLSProtocols()

Options & mongo::client::Options::setSSLDisabledTLSProtocols ( const std::vector< TLSProtocol > &  protocols)

Allow disabling particular TLS protocols.

Default: OpenSSL default

◆ setSSLMode()

Options & mongo::client::Options::setSSLMode ( SSLModes  sslMode = kSSLRequired)

If set to kSSLRequired, the driver will use SSL when connecting.

Default: kSSLDisabled

◆ setSSLPEMKeyFile()

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>

◆ setSSLPEMKeyPassword()

Options & mongo::client::Options::setSSLPEMKeyPassword ( const std::string &  password)

Configure the SSL PEM key password.

Has no effect if 'useSSL' is false.

Default: <empty>

◆ setValidateObjects()

Options & mongo::client::Options::setValidateObjects ( bool  value = true)

Configure whether BSON objects returned from the server should be validated.

Default: false


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