dittosynckit / live.ditto / DittoPendingIDSpecificOperation / update

update

fun update(closure: (DittoMutableDocument?) -> Unit): List<DittoUpdateResult>

Update the document with the matching ID.

Parameters

closure - a closure that gets called with the document matching the ID. If found, the document is a DittoMutableDocument, so you can call update-related functions on it. If the document is not found then the value provided to the closure will be null.

Return
a list of DittoUpdateResult that describes the updates that were performed on the document.

fun update(updater: DittoSingleMutableDocumentUpdater): List<DittoUpdateResult>

Update the document with the matching ID.

Parameters

updater - an object that implements DittoSingleMutableDocumentUpdater, whose update function gets called with the document matching the query, if the document is found. If the document is not found then the value provided to the function will be null.

Return
a list of DittoUpdateResult that describes the updates that were performed on the document.