insertWithStrategy

fun <T : Any> insertWithStrategy(value: T, id: DittoDocumentID? = null, writeStrategy: DittoWriteStrategy = DittoWriteStrategy.Overwrite): DittoDocumentID

Inserts a new document into the collection and returns the document's ID.

Return

the ID of the inserted document.

Parameters

value

the value to insert into the collection.

id

the ID to use for the document. If null then Ditto will automatically assign an ID.

writeStrategy

specifies the desired strategy for inserting a document. The default value is DittoWriteStrategy.Overwrite.