You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like that I have to load all documents with collection type into store & filter, it's a bit horrible!
May we can add such an count() method.
Besides that, I want to reserve the pagination feature.
I find out a simple but tricky solution:
Add ICollectionRxOptions['pagination'] which represents pagination options accepted by allDocs.
Copy & Paste Collection.all() to Collection.allDocs(options) and replace Colletion.loadDocs source with Collection.allDocs(options), we still need to call loadDocs with first ICollectionRxOptions['pagination'] value or startsWith {} at first.
Pass Collection._allDocsSubject to filter, then subscribe it to Filter.filter().
Subscribe to ICollectionRxOptions['pagination'] and call Collection._store.setDocs(res) to update store, and then the filter.
That's it.
Maybe some supported pagination related keys from allDocs options:
options.startkey & options.endkey: Get documents with IDs in a certain range (inclusive/inclusive).
options.inclusive_end: Include documents having an ID equal to the given options.endkey. Default: true.
options.limit: Maximum number of documents to return.
options.skip: Number of docs to skip before returning (warning: poor performance on IndexedDB/LevelDB!).
options.descending: Reverse the order of the output documents. Note that the order of startkey and endkey is reversed when descending:true.
The text was updated successfully, but these errors were encountered:
RxPouch/src/Collection.ts
Lines 179 to 190 in 31f412a
RxPouch/src/Filter.ts
Lines 27 to 29 in 31f412a
It looks like that I have to load all documents with collection type into store & filter, it's a bit horrible!
May we can add such an
count()
method.Besides that, I want to reserve the pagination feature.
I find out a simple but tricky solution:
ICollectionRxOptions['pagination']
which represents pagination options accepted by allDocs.Collection.all()
toCollection.allDocs(options)
and replaceColletion.loadDocs
source withCollection.allDocs(options)
, we still need to call loadDocs with firstICollectionRxOptions['pagination']
value or startsWith{}
at first.Collection._allDocsSubject
to filter, then subscribe it to Filter.filter().ICollectionRxOptions['pagination']
and callCollection._store.setDocs(res)
to update store, and then the filter.That's it.
Maybe some supported pagination related keys from allDocs options:
The text was updated successfully, but these errors were encountered: