Does anyone know of a way to filter a sync_gateway pull replication by a timestamp on a document? e.g. only pull documents with a timestamp in the last 30 minutes
I'm writing a location sharing app, and I don't want users to download documents (locations) that haven't been updated in the last 30 minutes since they are no longer relevant, and I don't want to waste the users data plan
At first I tried with channels and a cronjob. I had a script checking for expired documents and setting the isExpired property to true. My sync function would check that property and assign it either the 'expired' channel or the 'active' channel. The problem was that replications would still pull all revisions up until that document got moved to the 'expired' channel which defeated the purpose.
Then I tried it with permissions; by granting users access to only the 'active' channel. That successfully prevented all revisions of expired documents from being pulled. But the problem was that I then lost the ability to filter pull replications by an arbitrary channel (even if the user had access to that document through a different channel) . (I can explain why that is needed)
I've read in the comments that replication channels are just a convenience that set/get the filter and query_params properties, which I'm guessing queries the sync_gateway/_view/channels view. Is there a way to create my own view (emitting the updatedAt property) and ask the replication to filter by that view, using min and max query params?