userver: storages::mongo::WriteResult Class Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
storages::mongo::WriteResult Class Reference

MongoDB write operation result. More...

#include <userver/storages/mongo/write_result.hpp>

Public Member Functions

 WriteResult ()=default
 Creates an empty write result.
 
std::unordered_map< size_t, formats::bson::ValueUpsertedIds () const
 Map of _id values of upserted documents by operation (document) index.
 
std::optional< formats::bson::DocumentFoundDocument () const
 The document returned by FindAnd* operation if any.
 
std::unordered_map< size_t, MongoErrorServerErrors () const
 Map of server errors by operation (document) index.
 
std::vector< MongoErrorWriteConcernErrors () const
 Write concern errors.
 
Affected document counters

Valid only for acknowledged writes, i.e. non-zero write concern

size_t InsertedCount () const
 
size_t MatchedCount () const
 
size_t ModifiedCount () const
 
size_t UpsertedCount () const
 
size_t DeletedCount () const
 

Detailed Description

MongoDB write operation result.

Definition at line 17 of file write_result.hpp.

Member Function Documentation

◆ ServerErrors()

std::unordered_map< size_t, MongoError > storages::mongo::WriteResult::ServerErrors ( ) const

Map of server errors by operation (document) index.

For example, storages::mongo::Collection::InsertMany() with storages::mongo::options::Unordered and storages::mongo::options::SuppressServerExceptions option would produce a WriteResult with WriteResult::ServerErrors() containing information about failed insertions.

See also
options::SuppressServerExceptions

◆ WriteConcernErrors()

std::vector< MongoError > storages::mongo::WriteResult::WriteConcernErrors ( ) const

Write concern errors.

See also
options::SuppressServerExceptions

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