I was curious how CouchDB actually detects whether or not you have a conflict between documents.
Does it only depend on the version number and content of a document? And, if so, how is the number generated so it can be meaningful in detecting conflicts?
If version numbers were just the hash of the document then I don't see how they could be used to determine if a conflict has occurred. If the version number is a simple hash of the doc then you wouldn't be able to know, from the version number alone, if the docs are ancestors and thus you couldn't know if they are in conflict.
The version numbers must be more complex or there is more information involved...
It can't be a simple matter of incrementing the version number since that causes other problems and I can't imagine that would rely on modification times.
So how does CouchDB know if a document is an ancestor of another or in conflict?