Ditto 4.2.3
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ditto::WriteTransactionPendingIDSpecificOperation Class Reference

These objects are returned when ScopedWriteTransaction::find_by_id is called. More...

#include <WriteTransactionPendingIDSpecificOperation.hpp>

Public Member Functions

std::shared_ptr< Documentexec () const
 Execute the find operation to return the document with the matching ID, if it exists.
 
std::vector< std::unique_ptr< UpdateResult > > update (std::function< void(MutableDocument &)> fn) const
 Update the document with the matching ID.
 
bool remove () const
 Remove the document with the matching ID.
 
bool evict () const
 Evict the document with the matching ID.
 

Public Attributes

std::string collection_name
 
DocumentId document_id
 

Detailed Description

These objects are returned when ScopedWriteTransaction::find_by_id is called.

You can use them to perform updates on a document and remove or evict a document.

Member Function Documentation

◆ evict()

bool ditto::WriteTransactionPendingIDSpecificOperation::evict ( ) const

Evict the document with the matching ID.

Returns
true if the document was found and evicted. false if the document wasn't found and therefore wasn't evicted.

◆ exec()

std::shared_ptr< Document > ditto::WriteTransactionPendingIDSpecificOperation::exec ( ) const

Execute the find operation to return the document with the matching ID, if it exists.

Returns
The Document with the ID provided in the ScopedWriteTransaction::find_by_id call or nullptr if the document was not found.

◆ remove()

bool ditto::WriteTransactionPendingIDSpecificOperation::remove ( ) const

Remove the document with the matching ID.

Returns
true if the document was found and removed. false if the document wasn't found and therefore wasn't removed.

◆ update()

std::vector< std::unique_ptr< UpdateResult > > ditto::WriteTransactionPendingIDSpecificOperation::update ( std::function< void(MutableDocument &)>  fn) const

Update the document with the matching ID.

Parameters
fna lambda that gets called with the document matching the ID. If found, the document is a MutableDocument, so you can call update-related functions on it. If the document is not found then the value provided to the closure will be nullptr.
Returns
a list of UpdateResult that describes the updates that were performed on the document.

Member Data Documentation

◆ collection_name

std::string ditto::WriteTransactionPendingIDSpecificOperation::collection_name

The name of the collection that the operation will be performed within.

◆ document_id

DocumentId ditto::WriteTransactionPendingIDSpecificOperation::document_id

The ID of the document that the operation will apply to.