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

`#include <mongocxx/v1/server_api.hpp>`

## Description

Options related to MongoDB Stable API configuration.

Supported fields include:

- version
- strict
- deprecation_errors ("deprecationErrors")

See also
  - Stable API (MongoDB Manual)

## Public Types

enum class | errc
| Errors codes which may be returned by mongocxx::v1::server_api. More...
enum class | version
| The server API version. More...

## Public Member Functions

| server_api (server_api &&other) noexcept
| Move constructor.
| server_api (server_api const &other)
| Copy construction.
| server_api (version v)
| Initialize with the given server API version.
| ~server_api ()
| Destroy this object.
bsoncxx::v1::stdx::optional< bool > | deprecation_errors () const
| Return the current "deprecationErrors" field.
server_api & | deprecation_errors (bool v)
| Set the "deprecationErrors" field.
version | get_version () const
| Return the current "version" field.
server_api & | operator= (server_api &&other) noexcept
| Move assignment.
server_api & | operator= (server_api const &other)
| Copy assignment.
bsoncxx::v1::stdx::optional< bool > | strict () const
| Return the current "strict" field.
server_api & | strict (bool strict)
| Set the "strict" field.

## Static Public Member Functions

static std::error_category const & | error_category ()
| The error category for mongocxx::v1::server_api::errc.
static version | version_from_string (bsoncxx::v1::stdx::string_view v)
| Return the given server API version as an enumerator.
static std::string | version_to_string (version v)
| Return the given server API version as a string.

## Friends

std::error_code | make_error_code (errc v)
| Support implicit conversion to std::error_code.

## Member Enumeration Documentation

## errc

enum class mongocxx::v1::server_api::errc

strong

Errors codes which may be returned by mongocxx::v1::server_api.

Enumerator
zero | Zero.
invalid_version | The server API version is invalid.

## version

enum class mongocxx::v1::server_api::version

strong

The server API version.

Note
  Not to be confused with the MongoDB C++ Driver's API or ABI version.

Enumerator
k_version_1 | Stable API Version 1.

## Constructor & Destructor Documentation

## ~server_api()

mongocxx::v1::server_api::~server_api | ( |  | ) |

Destroy this object.

Warning
  Invalidates all associated views.

## server_api() [1/3]

mongocxx::v1::server_api::server_api | ( | server_api && | other | ) |

noexcept

Move constructor.

Postconditions:
  - other is in an assign-or-destroy-only state.

## server_api() [2/3]

mongocxx::v1::server_api::server_api | ( | server_api const & | other | ) |

Copy construction.

## server_api() [3/3]

mongocxx::v1::server_api::server_api | ( | version | v | ) |

explicit

Initialize with the given server API version.

Postconditions:
  - this->get_version() == v.
  - All other supported fields are "unset" or zero-initialized.

## Member Function Documentation

## deprecation_errors() [1/2]

bsoncxx::v1::stdx::optional< bool > mongocxx::v1::server_api::deprecation_errors | ( |  | ) | const

Return the current "deprecationErrors" field.

## deprecation_errors() [2/2]

server_api & mongocxx::v1::server_api::deprecation_errors | ( | bool | v | ) |

Set the "deprecationErrors" field.

## error_category()

std::error_category const & mongocxx::v1::server_api::error_category | ( |  | ) |

static

The error category for mongocxx::v1::server_api::errc.

## get_version()

version mongocxx::v1::server_api::get_version | ( |  | ) | const

Return the current "version" field.

## operator=() [1/2]

server_api & mongocxx::v1::server_api::operator= | ( | server_api && | other | ) |

noexcept

Move assignment.

Postconditions:
  - other is in an assign-or-destroy-only state.

## operator=() [2/2]

server_api & mongocxx::v1::server_api::operator= | ( | server_api const & | other | ) |

Copy assignment.

## strict() [1/2]

bsoncxx::v1::stdx::optional< bool > mongocxx::v1::server_api::strict | ( |  | ) | const

Return the current "strict" field.

## strict() [2/2]

server_api & mongocxx::v1::server_api::strict | ( | bool | strict | ) |

Set the "strict" field.

## version_from_string()

version mongocxx::v1::server_api::version_from_string | ( | bsoncxx::v1::stdx::string_view | v | ) |

static

Return the given server API version as an enumerator.

Exceptions

  mongocxx::v1::exception | with mongocxx::v1::server_api::errc::invalid_version when v is not a valid server API version.

## version_to_string()

std::string mongocxx::v1::server_api::version_to_string | ( | version | v | ) |

static

Return the given server API version as a string.

Exceptions

  mongocxx::v1::exception | with mongocxx::v1::server_api::errc::invalid_version when v is not a valid server API version.

## Friends And Related Symbol Documentation

## make_error_code

std::error_code make_error_code | ( | errc | v | ) |

friend

Support implicit conversion to std::error_code.

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

- mongocxx/v1/server_api.hpp