replace

inline suspend fun <T> replace(doc: TransactionGetResult, content: T, jsonSerializer: JsonSerializer? = null): TransactionGetResult

Mutates the specified doc with new content.

The mutation is staged until the transaction is committed. That is, any read of the document by any Couchbase component will see the document's current value, rather than this staged or 'dirty' data. If the attempt is rolled back, the staged mutation will be removed.

This staged data effectively locks the document from other transactional writes until the attempt completes (commits or rolls back).

If the mutation fails with a CasMismatchException or any other exception, the transaction will automatically roll back this attempt, then retry.

Return

the document, updated with its new CAS value.

Parameters

doc

identifies the document to update

content

the new content for the document.