MongoDB C++ Driver mongocxx-4.0.0
Loading...
Searching...
No Matches
mongocxx::v_noabi::options::server_api Class Reference

#include <mongocxx/v_noabi/mongocxx/options/server_api.hpp>

Description

Class representing options for server API.

See also

Public Types

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

Public Member Functions

 server_api (version version)
 Constructs a new server_api object.
 
const bsoncxx::v_noabi::stdx::optional< bool > & deprecation_errors () const
 Gets the current value of the deprecation errors option.
 
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.
 
version get_version () const
 Gets the declared server api version.
 
const bsoncxx::v_noabi::stdx::optional< bool > & strict () const
 Gets the current value of the strict option.
 
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.
 

Static Public Member Functions

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

Member Enumeration Documentation

◆ version

Enum representing the possible values for server API version.

Enumerator
k_version_1 

Stable API Version 1.

Constructor & Destructor Documentation

◆ server_api()

mongocxx::v_noabi::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 bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::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::v_noabi::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::v_noabi::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 bsoncxx::v_noabi::stdx::optional< bool > & mongocxx::v_noabi::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::v_noabi::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::v_noabi::options::server_api::version_from_string ( bsoncxx::v_noabi::stdx::string_view version)
static

Converts a version string to its enum value.

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

◆ version_to_string()

static std::string mongocxx::v_noabi::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::v_noabi::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: