MongoDB C++ Driver current
Loading...
Searching...
No Matches
mongocxx::v1 Namespace Reference

Description

Declares entities whose ABI stability is guaranteed for documented symbols.

Namespaces

namespace  events
 Declares entities describing APM events.
namespace  gridfs
 Declares entities related to GridFS.

Classes

class  aggregate_options
 Options for an "aggregate" command. More...
class  apm
 Options related to Application Performance Monitoring (APM) configuration. More...
class  auto_encryption_options
 Options related In-Use Encryption configuration. More...
class  bulk_write
 A list of bulk write operations. More...
class  change_stream
 A MongoDB change stream. More...
class  client
 A connection to a MongoDB deployment. More...
class  client_bulk_write
 A list of bulk write operations. Unlike mongocxx::v1::bulk_write, this supports writes across more than one collection and can group inserts, updates, and deletes in the same network payload. More...
class  client_encryption
 Support for MongoDB In-Use Encryption. More...
class  client_session
 A MongoDB client session. More...
class  collection
 A MongoDB collection. More...
class  count_options
 Options for a "countDocuments" operation. More...
class  cursor
 A MongoDB cursor. More...
class  data_key_options
 A Data Encryption Key (DEK) for In-Use Encryption. More...
class  database
 A MongoDB database. More...
class  default_logger
 A tag type representing mongoc's default unstructured log handler. More...
class  delete_many_options
 Options for a "deleteMany" operation. More...
class  delete_many_result
 The result of a "deleteMany" operation. More...
class  delete_one_options
 Options for a "deleteOne" operation. More...
class  delete_one_result
 The result of a "deleteOne" operation. More...
class  distinct_options
 Options for a "distinct" command. More...
class  encrypt_options
 Options related to explicit encryption for In-Use Encryption. More...
class  estimated_document_count_options
 Options for an "estimatedDocumentCount" operation. More...
class  exception
 Base class for all exceptions thrown by mongocxx::v1. More...
class  find_one_and_delete_options
 Options for a "findOneAndDelete" operation. More...
class  find_one_and_replace_options
 Options for a "findOneAndReplace" operation. More...
class  find_one_and_update_options
 Options for a "findOneAndUpdate" operation. More...
class  find_options
 Options for a "find" command. More...
class  hint
 Options related to a MongoDB query hint. More...
class  indexes
 Support for MongoDB indexes. More...
class  insert_many_options
 Options for an "insertMany" operation. More...
class  insert_many_result
 The result of an "insertMany" operation. More...
class  insert_one_options
 Options for an "insertOne" operation. More...
class  insert_one_result
 The result of an "insertOne" operation. More...
class  instance
 An instance of the MongoDB C++ Driver. More...
class  logger
 The interface for an unstructured log message handler. More...
class  logger_guard
 A scope guard to temporarily replace the current unstructured log message handler. More...
class  oidc_callback_params
 Parameters passed to an OIDC callback. More...
class  oidc_credential
 The credential returned by an OIDC callback. More...
class  pipeline
 A MongoDB aggregation pipeline. More...
class  pool
 A thread-safe pool of client objects. More...
class  range_options
 Options related to range_options queries for Queryable Encryption. More...
class  read_concern
 Options related to a MongoDB Read Concern. More...
class  read_preference
 Options related to a MongoDB Read Preference. More...
class  replace_one_options
 Options for a "replaceOne" operation. More...
class  replace_one_result
 The result of a "replaceOne" operation. More...
class  rewrap_many_datakey_options
 Options for a "rewrapManyDataKey" operation. More...
class  rewrap_many_datakey_result
 The result of a "rewrapManyDataKey" operation. More...
class  search_indexes
 Support for MongoDB Atlas Search indexes. More...
class  server_api
 Options related to MongoDB Stable API configuration. More...
class  server_error
 A MongoDB server error. More...
class  string_options
 Options related to string queries for Queryable Encryption. More...
class  text_options
 Options related to text queries for Queryable Encryption. More...
class  tls
 Options related to TLS configuration. More...
class  transaction_options
 Options related to a distributed transaction. More...
class  update_many_options
 Options for an "updateMany" operation. More...
class  update_many_result
 The result of an "updateMany" operation. More...
class  update_one_options
 Options for an "updateOne" operation. More...
class  update_one_result
 The result of an "updateOne" operation. More...
class  uri
 A MongoDB connection string. More...
class  write_concern
 Options related to a MongoDB Write Concern. More...

Typedefs

using log_handler
 The type of an unstructured log message handler.
using oidc_callback = std::function<oidc_credential (oidc_callback_params const&)>
 An OIDC credential callback function.

Enumerations

enum class  log_level
 The log level for an unstructured log message. More...
enum class  return_document
 returnDocument from the CRUD API specification. More...
enum class  source_errc
 Enumeration identifying the source of a mongocxx::v1 error. More...
enum class  type_errc
 Enumeration identifying the type (cause) of a mongocxx::v1 error. More...

Functions

std::error_condition make_error_condition (source_errc code)
 Support implicit conversion to std::error_condition.
std::error_condition make_error_condition (type_errc code)
 Support implicit conversion to std::error_condition.
void set_global_logger (log_handler handler)
 Set the process-global unstructured log message handler to a custom handler.
void set_global_logger (v1::default_logger tag)
 Set the process-global unstructured log message handler to mongoc's default handler.
std::error_category const & source_error_category ()
 The error category for mongocxx::v1::source_errc.
std::error_category const & type_error_category ()
 The error category for mongocxx::v1::type_errc.

Typedef Documentation

◆ log_handler

Initial value:
A polyfill for std::string_view.
Definition string_view.hpp:412
log_level
The log level for an unstructured log message.
Definition logger.hpp:37

The type of an unstructured log message handler.

The invocable is passed the log level, the message domain, and the message contents (in that order) for each unstructured log message emitted by mongoc.

The invocable must:

  • be std::is_nothrow_destructible<D>,
  • be std::is_nothrow_move_constructible<D>,
  • not throw an exception when invoked, and
  • not itself emit an unstructured log message (no reentrancy).
Important
Despite being a std::function<T>, log_handler is assumed to behave like a C++23 std::move_only_function<T>.
See also

◆ oidc_callback

An OIDC credential callback function.

The function receives callback parameters and returns an OIDC credential. If the function throws an exception, the exception is caught, an error is logged, and NULL is returned to libmongoc to signal failure.

Enumeration Type Documentation

◆ log_level

enum class mongocxx::v1::log_level
strong

The log level for an unstructured log message.

Enumerator
k_error 

MONGOC_LOG_LEVEL_ERROR.

k_critical 

MONGOC_LOG_LEVEL_CRITICAL.

k_warning 

MONGOC_LOG_LEVEL_WARNING.

k_message 

MONGOC_LOG_LEVEL_MESSAGE.

k_info 

MONGOC_LOG_LEVEL_INFO.

k_debug 

MONGOC_LOG_LEVEL_DEBUG.

k_trace 

MONGOC_LOG_LEVEL_TRACE.

◆ return_document

enum class mongocxx::v1::return_document
strong

returnDocument from the CRUD API specification.

See also
Enumerator
k_before 

Return the original document.

Note
Equivalent to "returnNewDocument": false.
k_after 

Return the updated document.

Note
Equivalent to "returnNewDocument": true.

◆ source_errc

enum class mongocxx::v1::source_errc
strong

Enumeration identifying the source of a mongocxx::v1 error.

Enumerator
zero 

Zero.

mongocxx 

From the mongocxx library.

mongoc 

From the mongoc library.

mongocrypt 

From the mongocrypt library.

server 

From the MongoDB server.

◆ type_errc

enum class mongocxx::v1::type_errc
strong

Enumeration identifying the type (cause) of a mongocxx::v1 error.

Enumerator
zero 

Zero.

invalid_argument 

An invalid argument passed to the throwing function.

runtime_error 

An erroneous condition was detected at runtime.

Function Documentation

◆ make_error_condition() [1/2]

std::error_condition mongocxx::v1::make_error_condition ( source_errc code)
inline

Support implicit conversion to std::error_condition.

◆ make_error_condition() [2/2]

std::error_condition mongocxx::v1::make_error_condition ( type_errc code)
inline

Support implicit conversion to std::error_condition.

◆ set_global_logger() [1/2]

void mongocxx::v1::set_global_logger ( log_handler handler)

Set the process-global unstructured log message handler to a custom handler.

Registers the custom unstructured log handler by calling mongoc_log_set_handler(). Unlike the logging behavior configured via mongocxx::v1::instance construction, the handler may be changed any number of times over the lifetime of the instance object.

A copy of handler is stored via type erasure; any compatible invocable is accepted.

Parameters
handlerThe handler to register. Disable unstructured logging when null (empty).
Warning
This function is NOT thread-safe. The global handler is replaced without synchronization, so the caller MUST ensure that no other thread concurrently configures the global handler (via this API or mongocxx::v1::logger_guard) or performs any operation which may emit an unstructured log message for the duration of this call.
Important
Must be called within the lifetime of a mongocxx::v1::instance object.
See also

◆ set_global_logger() [2/2]

void mongocxx::v1::set_global_logger ( v1::default_logger tag)

Set the process-global unstructured log message handler to mongoc's default handler.

Registers mongoc's default unstructured log handler by calling mongoc_log_set_handler().

Parameters
tagUnused: only for overload resolution.
Important
Must be called within the lifetime of a mongocxx::v1::instance object.

◆ source_error_category()

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

The error category for mongocxx::v1::source_errc.

◆ type_error_category()

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

The error category for mongocxx::v1::type_errc.