we have the following scenario: using a webapp, a user should be able to query a subset of all documents he has access to at a time, e.g. the latest 1000 docs on startup and if he scrolls past them, load the next batch. Access should use channel membership like the sync gateway does, without having to replicate the membership information externally and use this information to determine access when querying.
The problem with sync gateway is that there is no way to just get the latest 1000 docs and load more if necessary, but one could only query for all docs. The option to define a start- and endkey is not suitable when using UUIDs.
The problem with using Couchbase Server N1QL is that there seems to be no efficient and robust way to query for all documents the user was given access through channels. Or at least we couldn’t find any.
The problem with an offline solution like PouchDB is that the user has to load all documents on the first connect, and every time the local db is deleted (which might be regularly through company wide policies which wipe browser data)
Are there any best practices how a web app should query for a user’s docs, based on channel membership, without having to load them all at once?
Any help is greatly appreciated.