couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Jelsma" <>
Subject Re: Weird document update conflict on delete
Date Mon, 11 Jan 2010 22:22:23 GMT
Hello Michael,

For as far as i know this is indeed normal behavior. When you add a
document and specifying a revision ID, CouchDB will increment the revision
ID rendering any actions following using the `old` ID useless.

If you add a document using a revision ID, you must use the new revision
ID for all modifying actions for that document.

markus@relax:~$ curl -X PUT http://localhost:5984/bla

markus@relax:~$ curl -X PUT
http://localhost:5984/bla/2b866715d560a2e62e11df4cfcf7258a -d

Do you see the new revision ID? I cannot issue a delete using the revision
ID i specified during creation, let's see:

markus@relax:~$ curl -X DELETE
{"error":"conflict","reason":"Document update conflict."}

However, i can delete the document using the current revision ID, check it

markus@relax:~$ curl -X DELETE

Next time, remember the following rule of thumb. Any operation modifying
an existing document without using the _current_ revision ID will fire a
conflict error! Therefore you must always use the current revision ID.

Of course, this can also return a conflict but that will be due to another
person or process that beat you to it


 Michael Hoisie zei:
> Hi,
> I'm writing a couchdb library for Go (
> ) , and I'm running into this bizarre
> issue while testing the document delete method. This sequence of
> requests causes a document update conflict:
> 1. check if a database exists : HEAD 2.
> create a new database: PUT
> 3. add a document to the database POST
>   --> docid 2b866715d560a2e62e11df4cfcf7258a
>   --> revid 1-c7176253456a2d0378c55e597ed96ad3
> 4. delete the same document form the database:
> --> {"error":"conflict","reason":"Document update conflict."}
> I believe this fairly simple sequence of events should work. Is there
> anything here that's not allowed? I believe both the POST and DELETE are
> run on the same http connection. Could that be causing problems?
> I'm running CouchDBX 0.8 ( couchdb 0.10.0) on mac os x 10.6.
> Thanks,
> Mike

View raw message