We found out today that it is possible to have conflicts with _removed documents, and I’m running low on options for dealing with this scenario.
Consider the following sequence of events:
- Add document locally via CBLite. Ensure it pushes to the server.
- Go offline.
- Save more revisions locally.
- On the server (sync gateway), remove the user’s channel from the document.
- Make another server side change (add a property “foo”)
- Go back online on the device, let it pull down the changes (mainly the _removed doc)
- Couchbase Lite chooses the latest offline revision as the winner, and is in conflict with the _removed revision.
At this point, I have two options: use the _removed document as the winner (which CBLite did not choose as the current revision), or use my document as the winner.
The former option forces me to delete any local changes that may have been made to the document and accept the _removal. The latter results in overwriting the document on the server, which is sort of crazy. Even though my local document has no awareness of the additional modifications made in step 5 (because it can’t pull down the changes due to no channel access), the sync gateway will still accept my local, out of date revision as the “winner” and it overwrites what used to be the current revision without allowing me (CBLite) an opportunity to resolve any conflicts.
Even if I do an open_revs=all against the sync gateway, the server document that contained the property “foo” is gone.
Any guidance at all would be appreciated as to how to deal with removals and conflicts.