I have one application which is handled by two users, now
user A put document docA,
user B get docA,
now both are in offline mode,
now user A deletes docA,
and User B updates docA
and now both are online , and syncing started …
What exactly happened on server? is document deleted ? or conflict?
Deletions are not as destructive as you might think, they are simply revisions that are marked in a special way. So, you would have created a conflict. There would be one deleted revision and one non-deleted at the same level. By default, the non deleted revision wins and that is the revision that people will see if they don’t look at the conflicting revisions property.
No matter what you will have only one revision as the current revision. A delete will win over a non-delete, a higher revision number will win over a lower one and at the same level an arbitrary revision ID comparison will decide the winner. If you delete the current winner than the next eligible winner becomes the current revision. If there is no other eligible winner then the document is fully deleted. You don’t necessarily have to write logic to get rid of conflicts if you understand and accept that they will be there and might cause some unexpected behaviour when deleting a document.