save

expect fun save(document: MutableDocument)(source)

Saves a document to the database. When write operations are executed concurrently, the last writer will overwrite all other written values. Calling this method is the same as calling the ave(MutableDocument, ConcurrencyControl) method with LAST_WRITE_WINS concurrency control.

Parameters

document

The document.

Throws


expect fun save(document: MutableDocument, concurrencyControl: ConcurrencyControl): Boolean(source)

Saves a document to the database. When used with LAST_WRITE_WINS concurrency control, the last write operation will win if there is a conflict. When used with FAIL_ON_CONFLICT concurrency control, save will fail with false value

Return

true if successful. false if the FAIL_ON_CONFLICT concurrency

Parameters

document

The document.

concurrencyControl

The concurrency control.

Throws


expect fun save(document: MutableDocument, conflictHandler: ConflictHandler): Boolean(source)

Saves a document to the database. Conflicts will be resolved by the passed ConflictHandler. When write operations are executed concurrently and if conflicts occur, the conflict handler will be called. Use the conflict handler to directly edit the document to resolve the conflict. When the conflict handler returns 'true', the save method will save the edited document as the resolved document. If the conflict handler returns 'false', the save operation will be canceled with 'false' value returned as the conflict wasn't resolved.

Return

true if successful. false if the FAIL_ON_CONFLICT concurrency

Parameters

document

The document.

conflictHandler

A conflict handler.

Throws

actual fun save(document: MutableDocument)(source)
actual fun save(document: MutableDocument, conflictHandler: ConflictHandler): Boolean(source)
actual fun save(document: MutableDocument)(source)
actual fun save(document: MutableDocument, concurrencyControl: ConcurrencyControl): Boolean(source)
actual fun save(document: MutableDocument, conflictHandler: ConflictHandler): Boolean(source)