These objects are returned when ScopedWriteTransaction::find_by_id is called.
More...
|
| 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.
|
| |
| std::vector< std::unique_ptr< UpdateResult > > | update_v2 (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.
|
| |
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.
◆ 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_v2()
| std::vector< std::unique_ptr< UpdateResult > > ditto::WriteTransactionPendingIDSpecificOperation::update_v2 |
( |
std::function< void(MutableDocument *)> | fn | ) |
const |
Update the document with the matching ID.
- Parameters
-
| 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. |
- Returns
- a list of
UpdateResult that describes the updates that were performed on the document.
◆ 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.