MongoDB C++ Driver  mongocxx-3.7.0
Classes | Enumerations | Functions
mongocxx Namespace Reference

Top level namespace for the MongoDB C++ driver. More...

Classes

class  authentication_exception
 Class representing an exception during authentication. More...
 
class  bulk_write
 Class representing a batch of write operations that can be sent to the server as a group. More...
 
class  bulk_write_exception
 Class representing an exception during a bulk write operation. More...
 
class  change_stream
 Class representing a MongoDB change stream. More...
 
class  client
 Class representing a client connection to MongoDB. More...
 
class  client_encryption
 Class supporting operations for MongoDB Client-Side Field Level Encryption. More...
 
class  client_session
 Use a session for a sequence of operations, optionally with either causal consistency or snapshots. More...
 
class  collection
 Class representing server side document groupings within a MongoDB database. More...
 
class  cursor
 Class representing a pointer to the result set of a query on a MongoDB server. More...
 
class  database
 Class representing a MongoDB database. More...
 
class  exception
 A class to be used as the base class for all mongocxx exceptions. More...
 
class  gridfs_exception
 Class representing an error encountered when attempting to perform the requested GridFS operation. More...
 
class  hint
 Class representing a hint to be passed to a database operation. More...
 
class  index_model
 Class representing an index on a MongoDB server. More...
 
class  index_view
 Class representing a MongoDB index view. More...
 
class  instance
 Class representing an instance of the MongoDB driver. More...
 
class  logger
 The interface that all user-defined loggers must implement. More...
 
class  logic_error
 Class representing an exception caused by using the mongocxx API improperly. More...
 
class  operation_exception
 Class representing an exception received from a MongoDB server. More...
 
class  pipeline
 Class representing a MongoDB aggregation pipeline. More...
 
class  pool
 A pool of client objects associated with a MongoDB deployment. More...
 
class  query_exception
 Class representing an exception during a query operation. More...
 
class  read_concern
 A class to represent the read concern. More...
 
class  read_preference
 Class representing a preference for how the driver routes read operations to members of a replica set or to a sharded cluster. More...
 
class  uri
 Class representing a MongoDB connection string URI. More...
 
class  validation_criteria
 Class representing criteria for document validation, to be applied to a collection. More...
 
class  write_concern
 Class representing the server-side requirement for reporting the success of a write operation. More...
 
class  write_exception
 Class representing an exception during a write operation. More...
 

Enumerations

enum  error_code : std::int32_t {
  error_code::k_cannot_recreate_instance = 1, error_code::k_invalid_client_object, error_code::k_invalid_collection_object, error_code::k_invalid_database_object,
  error_code::k_invalid_parameter, error_code::k_ssl_not_supported, error_code::k_unknown_read_concern, error_code::k_unknown_write_concern,
  error_code::k_server_response_malformed, error_code::k_invalid_uri, error_code::k_invalid_gridfs_bucket_object, error_code::k_invalid_gridfs_uploader_object,
  error_code::k_invalid_gridfs_downloader_object, error_code::k_gridfs_stream_not_open, error_code::k_gridfs_upload_requires_too_many_chunks, error_code::k_gridfs_file_not_found,
  error_code::k_gridfs_file_corrupted, error_code::k_instance_destroyed, error_code::k_cannot_create_session, error_code::k_invalid_session,
  error_code::k_invalid_transaction_options_object
}
 Enum representing the various error types that can occur during driver usage. More...
 
enum  server_error_code : std::int32_t
 Enum representing the various errors types that can be returned from the server. More...
 
enum  log_level
 The log level of a message passed to a mongocxx::logger.
 
enum  write_type {
  write_type::k_insert_one, write_type::k_delete_one, write_type::k_delete_many, write_type::k_update_one,
  write_type::k_update_many, write_type::k_replace_one
}
 Enum representing the the types of write operations that can be performed. More...
 

Functions

const std::error_category & error_category ()
 Get the error_category for mongocxx library exceptions. More...
 
std::error_code make_error_code (error_code error)
 Translate a mongocxx::error_code into a std::error_code. More...
 
const std::error_category & server_error_category ()
 Get the error_category for mongocxx library exceptions. More...
 
std::error_code make_error_code (server_error_code error)
 Translate a mongocxx::server_error_code into a std::error_code. More...
 
stdx::string_view to_string (log_level level)
 Returns a stringification of the given log level. More...
 

Detailed Description

Top level namespace for the MongoDB C++ driver.

Enumeration Type Documentation

◆ error_code

enum mongocxx::error_code : std::int32_t
strong

Enum representing the various error types that can occur during driver usage.

Enumerator
k_cannot_recreate_instance 

More than one mongocxx::instance has been created.

k_invalid_client_object 

A default-constructed or moved-from mongocxx::client object has been used.

k_invalid_collection_object 

A default-constructed or moved-from mongocxx::collection object has been used.

k_invalid_database_object 

A default-constructed or moved-from mongocxx::database object has been used.

k_invalid_parameter 

An invalid or out-of-bounds parameter was provided.

k_ssl_not_supported 

An SSL operation was used without SSL support being built.

k_unknown_read_concern 

An unknown read concern level was set.

k_unknown_write_concern 

An unknown write concern level was set.

k_server_response_malformed 

The server returned a malformed response.

k_invalid_uri 

An invalid MongoDB URI was provided.

k_invalid_gridfs_bucket_object 

A default-constructed or moved-from mongocxx::gridfs::bucket object has been used.

k_invalid_gridfs_uploader_object 

A default-constructed or moved-from mongocxx::gridfs::uploader object has been used.

k_invalid_gridfs_downloader_object 

A default-constructed or moved-from mongocxx::gridfs::downloader object has been used.

k_gridfs_stream_not_open 

A mongocxx::gridfs::uploader object was not open for writing, or a mongocxx::gridfs::downloader object was not open for reading.

k_gridfs_upload_requires_too_many_chunks 

A mongocxx::gridfs::uploader object has exceeded the maximum number of allowable GridFS chunks when attempting to upload the requested file.

k_gridfs_file_not_found 

The requested GridFS file was not found.

k_gridfs_file_corrupted 

A GridFS file being operated on was discovered to be corrupted.

k_instance_destroyed 

The mongocxx::instance has been destroyed.

k_cannot_create_session 

mongocxx::client.create_session failed to create a mongocxx::client_session.

k_invalid_session 

A failure attempting to pass a mongocxx::client_session to a method.

k_invalid_transaction_options_object 

A moved-from mongocxx::options::transaction object has been used.

◆ server_error_code

enum mongocxx::server_error_code : std::int32_t
strong

Enum representing the various errors types that can be returned from the server.

As this list changes over time, this is just a placeholder for an Int32 error code value from the server.

◆ write_type

enum mongocxx::write_type
strong

Enum representing the the types of write operations that can be performed.

Enumerator
k_insert_one 

Inserting a single document into a collection.

k_delete_one 

Deleting a single document from a collection.

k_delete_many 

Delete one or more documents from a collection.

k_update_one 

Update a single document in a collection.

k_update_many 

Update one or more documents in a collection.

k_replace_one 

Replace a single document in a collection with a new one.

Function Documentation

◆ error_category()

const std::error_category& mongocxx::error_category ( )

Get the error_category for mongocxx library exceptions.

Returns
The mongocxx error_category

◆ make_error_code() [1/2]

std::error_code mongocxx::make_error_code ( error_code  error)

Translate a mongocxx::error_code into a std::error_code.

Parameters
errorA mongocxx::error_code
Returns
A std::error_code

◆ make_error_code() [2/2]

std::error_code mongocxx::make_error_code ( server_error_code  error)

Translate a mongocxx::server_error_code into a std::error_code.

Parameters
errorA mongocxx::error_code
Returns
A std::error_code

◆ server_error_category()

const std::error_category& mongocxx::server_error_category ( )

Get the error_category for mongocxx library exceptions.

Returns
The mongocxx error_category

◆ to_string()

stdx::string_view mongocxx::to_string ( log_level  level)

Returns a stringification of the given log level.

Parameters
levelThe type to stringify.
Returns
a std::string representation of the type.