How to manage pouchdb and couchdb synchronization?

帅比萌擦擦* 提交于 2019-12-02 20:56:28

What's happening is that you have conflicts to the same document, because it is modified in one way by the server and another way by the client. One conflicting version is winning arbitrarily, and the other is losing.

You can either resolve the conflicts or (the more reasonable solution in your case) store multiple documents per user instead of one big document.

Just because you have one database per user doesn't mean you need to have one document per user. :) E.g your docs could be:

{_id: "Tran_1", status: "Pending"}
{_id: "Tran_2", status: "Pending"}
// etc.

These documents would be created once on the client and updated once on the server. No possibility of conflicts. Piece of cake!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!