incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luis Miguel Silva <luismiguelferreirasi...@gmail.com>
Subject Update conflicts?
Date Tue, 05 Apr 2011 21:46:10 GMT
Dear all,

I'm trying to play around with updates and i'm bumping into some problems.

Let's image we have to clients that poll a document from the server at
the same time and get the same _rev.
Then one of them updates the doc based on the _rev it got:
[root@xkitten ~]# curl -X PUT -d
'{"_rev":"3-0d519bcf08130bf784f3c35d79760740","hello2":"fred2"}'
http://localhost:5984/benchmark/test?conflicts=true
{"ok":true,"id":"test","rev":"4-03640ebafbb4fcaf127844671f8e2de7"}
Then another one tries to update the doc based on the same exact _rev:
[root@xkitten ~]# curl -X PUT -d
'{"_rev":"3-0d519bcf08130bf784f3c35d79760740","hello3":"fred3"}'
http://localhost:5984/benchmark/test?conflicts=true
{"error":"conflict","reason":"Document update conflict."}
[root@xkitten ~]#

Is there a way to avoid this?! (like...make the update just create a
new _rev or something)??

Ideally, we would be able to update without specifying the _rev, just
posting (or, in this case PUTting) to the document...

Thoughts??

Thank you,
Luis

Mime
View raw message