userver: storages::mongo::WriteResult Class Reference
No Matches
storages::mongo::WriteResult Class Reference

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

Detailed Description

MongoDB write operation result.

Definition at line 17 of file 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

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

◆ WriteConcernErrors()

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

Write concern errors.

See also

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