insert

fun <T : Any> insert(value: T, id: DittoDocumentID? = null, isDefault: Boolean = false): 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.

isDefault

represents whether or not the data being inserted should be treated as default data or not. Set this to true if you want to set a default value that you expect to be overwritten by other devices in the network. The default value is false.