upsert
fun <T : Any> upsert( value: T, writeStrategy: DittoWriteStrategy = Merge, hint: String? = null): DittoDocumentId
Content copied to clipboard
Inserts a new document into the collection and returns its identifier. If the document already exists, the behavior is determined by the given writeStrategy
.
Return
The identifier of the inserted document.
Parameters
value
The value to insert into the collection.
write Strategy
Specifies the desired strategy for inserting a document. The default value is DittoWriteStrategy.Merge
.
hint
A hint of what this upsert is doing. This is logged for debugging in the case of blocked transactions.
Throws
Thrown if the value provided could not be upserted. This could be due to a serialization error or an I/O related error.