MongoDB C++ Driver  mongocxx-3.7.0
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mongocxx::options::server_api Class Reference

Class representing options for server API. More...

#include <server_api.hpp>

Public Types

enum  version
 Enum representing the possible values for server API version.
 

Public Member Functions

 server_api (version version)
 Constructs a new server_api object. More...
 
server_apistrict (bool strict)
 Sets the strict option, specifying whether the server should return errors for features that are not part of the declared API version. More...
 
const stdx::optional< bool > & strict () const
 Gets the current value of the strict option. More...
 
server_apideprecation_errors (bool deprecation_errors)
 Sets the deprecation errors option, specifying whether the server should return errors for features that are deprecated in the declared API version. More...
 
const stdx::optional< bool > & deprecation_errors () const
 Gets the current value of the deprecation errors option. More...
 
version get_version () const
 Gets the declared server api version. More...
 

Static Public Member Functions

static std::string version_to_string (version version)
 Converts a version enum value to its string value. More...
 
static version version_from_string (stdx::string_view version)
 Converts a version string to its enum value. More...
 

Friends

class mongocxx::client
 
class mongocxx::pool
 

Detailed Description

Class representing options for server API.

Constructor & Destructor Documentation

◆ server_api()

mongocxx::options::server_api::server_api ( version  version)

Constructs a new server_api object.

The specified API version will be sent to the server. This will cause the server to behave in a manner compatible with that API version. The driver will behave in a manner compatible with a server configured with that API version, regardless of the server's actual release version.

Parameters
versionThe server api version to send to the server.

Member Function Documentation

◆ deprecation_errors() [1/2]

const stdx::optional<bool>& mongocxx::options::server_api::deprecation_errors ( ) const

Gets the current value of the deprecation errors option.

Returns
The optional value of the deprecation errors option.

◆ deprecation_errors() [2/2]

server_api& mongocxx::options::server_api::deprecation_errors ( bool  deprecation_errors)

Sets the deprecation errors option, specifying whether the server should return errors for features that are deprecated in the declared API version.

Parameters
deprecation_errorsThe value to set deprecation errors to.
Returns
A reference to this object to facilitate method chaining.

◆ get_version()

version mongocxx::options::server_api::get_version ( ) const

Gets the declared server api version.

Returns
The version enum value specifying the declared server api version.

◆ strict() [1/2]

const stdx::optional<bool>& mongocxx::options::server_api::strict ( ) const

Gets the current value of the strict option.

Returns
The optional value of the strict option.

◆ strict() [2/2]

server_api& mongocxx::options::server_api::strict ( bool  strict)

Sets the strict option, specifying whether the server should return errors for features that are not part of the declared API version.

Parameters
strictThe value to set strict to.
Returns
A reference to this object to facilitate method chaining.

◆ version_from_string()

static version mongocxx::options::server_api::version_from_string ( stdx::string_view  version)
static

Converts a version string to its enum value.

Parameters
versionThe string to convert to an enum value.
Exceptions
mongocxx::logic_erroron an invalid argument
Returns
The enum value of the given string.

◆ version_to_string()

static std::string mongocxx::options::server_api::version_to_string ( version  version)
static

Converts a version enum value to its string value.

Parameters
versionThe enum value to convert to a string.
Exceptions
mongocxx::logic_erroron an invalid argument
Returns
The string value of the given enum value.

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