Solve lattice

I am developing a prototype website that works offline that uses Pouch DB so that it syncs with CouchDB on the server when it goes online.

The DB folder conflicts guide says:

To resolve the conflict, you simply use () a new revision on top of the current winner.

How do you do it? I tried the following functions but didn't work as expected:

function (current, chosen) {
    chosen._rev = current._rev;
    chosen._conflicts = [];
    db.put(chosen);
};

function (chosen) {;
    db.put(chosen);
};

      

The top function accepts two documents:

  • Document that is the current winner
  • The document selected by the user to become the new winner.

I read in some places (

+3


source to share


1 answer


You're right; you need to remove the losing conflicts (which is not how it sounds). I made a mistake when I wrote the guide; conflicts will exist if you do not remove them.

By the way, removing conflicting versions simply means adding a tombstone over them. So nothing really "gets deleted" unless you explicitly compile your database. This applies to both PouchDB and CouchDB.



Edit: I have corrected the docs. Anyway, could you please update the guide to reflect the fact that you need to remove any unwanted conflicting versions? We love pull requests, especially from people who have tackled this view first-hand! :) The document that needs to be changed is this one .

+7


source







All Articles