DittoPendingCursorOperation

class DittoPendingCursorOperation

These objects are returned when using find-like functionality on DittoCollections. They allow chaining of further query-related functions to do things like add a limit to the number of documents you want returned or specify how you want the documents to be sorted and ordered. You can either call exec on the object to get an array of DittoDocuments as an immediate return value, or you can establish either a live query or a subscription, which both work over time. A live query, established by calling observe, will notify you every time there's an update to a document that matches the query you provided in the preceding find-like call. A subscription, established by calling subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about documents that match the query you provided in the preceding find-like call. Calling observe will generate both a subscription and a live query at the same time. If you'd like to only observe local changes then you can call observeLocal. Update and remove functionality is also exposed through this object.

Functions

evict
Link copied to clipboard
fun evict(): List<DittoDocumentID>
Evict all documents that match the query generated by the preceding function chaining.
exec
Link copied to clipboard
fun exec(): List<DittoDocument>
Execute the query generated by the preceding function chaining and return the list of matching documents.
limit
Link copied to clipboard
fun limit(limit: Int): DittoPendingCursorOperation
Limit the number of documents that get returned when querying a collection for matching documents.
observe
Link copied to clipboard
fun observe(eventHandler: (List<DittoDocument>, DittoLiveQueryEvent) -> Unit): DittoLiveQuery
Enables you to listen for changes that occur on a collection.
fun observe(callback: DittoLiveQueryCallback): DittoLiveQuery
Enables you to listen for changes that occur on a collection.
observeLocal
Link copied to clipboard
fun observeLocal(eventHandler: (List<DittoDocument>, DittoLiveQueryEvent) -> Unit): DittoLiveQuery
Enables you to listen for changes that occur on a collection.
fun observeLocal(callback: DittoLiveQueryCallback): DittoLiveQuery
Enables you to listen for changes that occur on a collection.
observeLocalWithNextSignal
Link copied to clipboard
Enables you to listen for changes that occur on a collection, and to signal when you are ready for the live query to deliver the next event.
Enables you to listen for changes that occur on a collection, and to signal when you are ready for the live query to deliver the next event.
observeWithNextSignal
Link copied to clipboard
fun observeWithNextSignal(eventHandler: (List<DittoDocument>, DittoLiveQueryEvent, DittoSignalNext) -> Unit): DittoLiveQuery
Enables you to listen for changes that occur on a collection, and to signal when you are ready for the live query to deliver the next event.
Enables you to listen for changes that occur on a collection, and to signal when you are ready for the live query to deliver the next event.
offset
Link copied to clipboard
fun offset(offset: Int): DittoPendingCursorOperation
Offset the resulting set of matching documents.
remove
Link copied to clipboard
fun remove(): List<DittoDocumentID>
Remove all documents that match the query generated by the preceding function chaining.
sort
Link copied to clipboard
fun sort(query: String, direction: DittoSortDirection): DittoPendingCursorOperation
Sort the documents that match the query provided in the preceding find-like function call.
subscribe
Link copied to clipboard
fun subscribe(): DittoSubscription
Enables you to subscribe to changes that occur on a collection.
update
Link copied to clipboard
fun update(closure: (List<DittoMutableDocument>) -> Unit): Map<DittoDocumentID, List<DittoUpdateResult>>
Update documents that match the query generated by the preceding function chaining.
fun update(updater: DittoMutableDocumentsUpdater): Map<DittoDocumentID, List<DittoUpdateResult>>
Update documents that match the query generated by the preceding function chaining.

Properties

collectionName
Link copied to clipboard
val collectionName: String
the name of the collection that the operation will be performed on.
limit
Link copied to clipboard
var limit: Int
offset
Link copied to clipboard
var offset: Int = 0
orderByDefinitions
Link copied to clipboard
var orderByDefinitions: MutableList<COrderByParam_t>
query
Link copied to clipboard
val query: String
the query that will be used when performing the operation.
queryArgs
Link copied to clipboard
val queryArgs: Map<String, Any?>?