Ditto 4.4.5
|
These objects are returned when ScopedWriteTransaction::find_by_id is called. More...
#include <WriteTransactionPendingIDSpecificOperation.hpp>
Public Member Functions | |
std::shared_ptr< Document > | exec () 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 |
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.
bool ditto::WriteTransactionPendingIDSpecificOperation::evict | ( | ) | const |
Evict the document with the matching ID.
true
if the document was found and evicted. false
if the document wasn't found and therefore wasn't evicted. std::shared_ptr< Document > ditto::WriteTransactionPendingIDSpecificOperation::exec | ( | ) | const |
Execute the find operation to return the document with the matching ID, if it exists.
Document
with the ID provided in the ScopedWriteTransaction::find_by_id call or nullptr
if the document was not found. bool ditto::WriteTransactionPendingIDSpecificOperation::remove | ( | ) | const |
Remove the document with the matching ID.
true
if the document was found and removed. false
if the document wasn't found and therefore wasn't removed. std::vector< std::unique_ptr< UpdateResult > > ditto::WriteTransactionPendingIDSpecificOperation::update | ( | std::function< void(MutableDocument &)> | fn | ) | const |
Update the document with the matching ID.
fn | a 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 . |
UpdateResult
that describes the updates that were performed on the document. std::string ditto::WriteTransactionPendingIDSpecificOperation::collection_name |
The name of the collection that the operation will be performed within.
DocumentId ditto::WriteTransactionPendingIDSpecificOperation::document_id |
The ID of the document that the operation will apply to.