In my android app i have setup pull replication with sync_gateway.
Due to the specific app's logic, whenever a conflict is detected, i need to keep just the document revision replicated from the server.
I'm able to define which conflicting version comes from the replication (server) and which one comes from a local modification (mobile app).
If i create tombstones and a new revision with the data from the replication revision (which is the suggested approach), i will have continuos conflicts because the local revision id will be always different from the one on the server (any new revision used to elect the currentRevision will have a different id).
My best solution would be to keep just the server revision as the current revision and discard any other.
How can i do this?
Is it possible to purge revisions? Or is it possibile to create an object that contains just the server revision so that after conflict resolution any other pull without conflict will just update my document? I need a behaviour similar to an override.
It depends what the outcome of the conflict resolution should be:
Merging document properties: in this case you need to create a new revision whose properties are from each conflicting revision and then delete all the revisions.
Cleaning up conflicting revisions: in this case you can delete all the revisions except the one you'd like to keep. It may be that the revision you want to keep is not the current revision but removing all other revisions will make it become the current revision.
See the TodoLite-Android conflict resolution example (https://github.com/couchbaselabs/ToDoLite-Android/blob/bcd87faa4c68a7cee075468b08da55c8041830a7/ToDoLite/src/main/java/com/couchbase/todolite/ListConflicts.java#L51-L81).