Markus, thanks for the clarification and the examples -- the problem was a bug in the Go http library I use :)
- Mike On Mon, Jan 11, 2010 at 2:22 PM, Markus Jelsma <[email protected]> wrote: > 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. > > mar...@relax:~$ curl -X PUT http://localhost:5984/bla > {"ok":true} > > mar...@relax:~$ curl -X PUT > http://localhost:5984/bla/2b866715d560a2e62e11df4cfcf7258a -d > '{"_rev":"1-c7176253456a2d0378c55e597ed96ad3"}' > {"ok":true,"id":"2b866715d560a2e62e11df4cfcf7258a","rev":"2-ce5f1bb80a4b215d152444b303ecd73e"} > > Do you see the new revision ID? I cannot issue a delete using the revision > ID i specified during creation, let's see: > > mar...@relax:~$ curl -X DELETE > http://localhost:5984/bla/2b866715d560a2e62e11df4cfcf7258a?rev=1-c7176253456a2d0378c55e597ed96ad3 > {"error":"conflict","reason":"Document update conflict."} > > However, i can delete the document using the current revision ID, check it > out: > > mar...@relax:~$ curl -X DELETE > http://localhost:5984/bla/2b866715d560a2e62e11df4cfcf7258a?rev=2-ce5f1bb80a4b215d152444b303ecd73e > {"ok":true,"id":"2b866715d560a2e62e11df4cfcf7258a","rev":"3-ba96b157226112e17db64f687416aafb"} > > > 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 > > > Cheers, > > > Michael Hoisie zei: >> Hi, >> >> I'm writing a couchdb library for Go ( >> http://github.com/hoisie/gocouch ) , 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 http://127.0.0.1:5984/test123 2. >> create a new database: PUT http://127.0.0.1:5984/test123 >> 3. add a document to the database POST http://127.0.0.1:5984/test123/ >> --> docid 2b866715d560a2e62e11df4cfcf7258a >> --> revid 1-c7176253456a2d0378c55e597ed96ad3 >> 4. delete the same document form the database: >> DELETE >> http://127.0.0.1:5984/test123/2b866715d560a2e62e11df4cfcf7258a?rev=1-c7176253456a2d0378c55e597ed96ad3 >> --> {"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 > > > >
