CouchDB filtered replication - remove a document

前端 未结 2 1010
野性不改
野性不改 2021-02-09 18:52

I am trying to setup filtered replication between a master and user database. Documents in the master contain a list of user groups that have permission to the document.

2条回答
  •  孤城傲影
    2021-02-09 19:17

    This is a tricky subject. The options we have considered are:

    1. 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.
    2. 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

提交回复
热议问题