This is a tricky subject. The options we have considered are:
- When the group changes copy the document and save the new group to the copy, then delete the original. The delete will propagate through the filter and remove from the remote DB. Downsides are loss of revisions and breakage if the ID was referenced from other docs.
- Have the user database write a manifest file listing all the docs in the DB, which syncs back to the master (we had this already to track document delivery, and read status). Compare that to the intended (filtered) document list and tell the user database to PURGE (not DELETE) the docs that should no longer be present.
Best reference I have found is here: http://pouchdb.com/2015/04/05/filtered-replication.html