Loading...
Searching...
No Matches
mongocxx::options::server_api Class Reference

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

## Description

Used by mongocxx::v_noabi::options::client::server_api_opts.

See also
  - Stable API (MongoDB Manual)

## Public Types

using | version = v1::server_api::version
| Enum representing the possible values for server API version.

## Public Member Functions

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

## 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 Typedef Documentation

## version

using mongocxx::v_noabi::options::server_api::version = v1::server_api::version

Enum representing the possible values for server API version.

## Constructor & Destructor Documentation

## server_api() [1/2]

mongocxx::v_noabi::options::server_api::server_api | ( | version | version | ) |

inline

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

  version | The server api version to send to the server.

## server_api() [2/2]

mongocxx::v_noabi::options::server_api::server_api | ( | v1::server_api const & | opts | ) |

inline

Construct with the mongocxx::v1 equivalent.

## Member Function Documentation

## deprecation_errors() [1/2]

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

inline

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

inline

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

Parameters

  deprecation_errors | The 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

inline

Gets the declared server api version.

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

## operator v1::server_api()

mongocxx::v_noabi::options::server_api::operator v1::server_api | ( |  | ) | const

inline explicit

Convert to the mongocxx::v1 equivalent.

## strict() [1/2]

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

inline

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

inline

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

Parameters

  strict | The value to set strict to.

Returns
  A reference to this object to facilitate method chaining.

## version_from_string()

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

  version | The string to convert to an enum value.

Exceptions

  mongocxx::v_noabi::logic_error | on an invalid argument

Returns
  The enum value of the given string.

## version_to_string()

std::string mongocxx::v_noabi::options::server_api::version_to_string | ( | version | version | ) |

static

Converts a version enum value to its string value.

Parameters

  version | The enum value to convert to a string.

Exceptions

  mongocxx::v_noabi::logic_error | on an invalid argument

Returns
  The string value of the given enum value.

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

- mongocxx/v_noabi/mongocxx/options/server_api.hpp