On 05/20/2011 09:46 AM, Oren Shani wrote:
> The problem is that if I have to applications calling the function
> concurrently, it might end up with a conflict, and then the document in
> the database will have for example keyhash["abcd"] =5 /or
> /keyhsah["efgh"] = 5 instead of keyhash["abcd"] = 5 /and/
> keyhash["efgh"] = 6 (this is a rather classical concurrency conflict
> problem so I suppose you understand what I mean...)

GET your document with conflicts=true. If there are any conflicting
revisions, GET those revisions as well. Then just merge together in a
single document, write that correct document, and delete the conflicting
revisions. I use a single POST to _bulk_docs for that part.

See:
http://wiki.apache.org/couchdb/Replication_and_conflicts

-- 
Owen Marshall
FacilityONE
http://www.facilityone.com | (502) 805-2126

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to