Resolving replication conflicts for deleted documents in CouchDB

前端 未结 1 1551
不知归路
不知归路 2021-02-19 23:50

The way of resolving replication conflicts recommended by official documentation is:

  1. Read conflicting revisions using document\'s _conflicts field (e.
相关标签:
1条回答
  • 2021-02-20 00:39

    The best solution would be to use the reserved property _deleted to remove documents instead of HTTP DELETE. Then you are free to also set other properties:

    doc._deleted = true;
    doc.deletedByUser = true;
    doc.save();
    

    Then in the merge process check the _changes feed for _deleted_conflicts and delete the document if there is a revision within _deleted_conflicts that has the deletedByUser flag set to true.

    I hope this helps!

    0 讨论(0)
提交回复
热议问题