DittoCollection

class DittoCollection

A reference to a collection in a DittoStore.

Functions

fetchAttachment
Link copied to clipboard
fun fetchAttachment(token: DittoAttachmentToken, onFetchEvent: (DittoAttachmentFetchEvent) -> Unit): DittoAttachmentFetcher
fun fetchAttachment(token: DittoAttachmentToken, fetchEventHandler: DittoAttachmentFetchEventHandler): DittoAttachmentFetcher

Trigger an attachment to be downloaded locally to the device and observe its progress as it does so.

find
Link copied to clipboard
fun find(query: String): DittoPendingCursorOperation
fun find(query: String, queryArgs: Map<String, Any?>): DittoPendingCursorOperation

Generates a DittoPendingCursorOperation with the provided query that can be used to find the documents matching the query at a point in time or you can chain a call to observe, observeLocal, or subscribe if you want to get updates about documents matching the query as they occur.

findAll
Link copied to clipboard
fun findAll(): DittoPendingCursorOperation

Generates a DittoPendingCursorOperation that can be used to find all documents in the collection at a point in time or you can chain a call to observe, observeLocal, or subscribe if you want to get updates about documents in the collection over time.

findByID
Link copied to clipboard
fun findByID(id: Any): DittoPendingIDSpecificOperation
fun findByID(id: DittoDocumentID): DittoPendingIDSpecificOperation

Generates a DittoPendingIDSpecificOperation with the provided document ID that can be used to find the document at a point in time or you can chain a call to observe, observeLocal, or subscribe if you want to get updates about the document over time.

insert
Link copied to clipboard
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.

insertWithStrategy
Link copied to clipboard
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.

newAttachment
Link copied to clipboard
fun newAttachment(inputStream: InputStream, metadata: Map<String, String> = emptyMap()): DittoAttachment?
fun newAttachment(path: String, metadata: Map<String, String> = emptyMap()): DittoAttachment?

Creates a new attachment, which can then be inserted into a document.

upsert
Link copied to clipboard
fun <T : Any> upsert(value: T, writeStrategy: DittoWriteStrategy = DittoWriteStrategy.Merge): DittoDocumentID

Inserts a new document into the collection and returns its ID. If the document already exists, the behavior is determined by the given writeStrategy.

Properties

name
Link copied to clipboard
val name: String

the name of the collection.