CouchDB differs from those other databases in that the other databases allow you to update a single field, rather than clobber the whole row. E.g. In SQL, you'd write something like "update field1 = 35 where I'd = 17" and if somebody had modified field2 in the interim, your query wouldn't undo their change. In contrast, with couchDB, you're PUTting the whole document, which *would* undo their change, hence the need for specifying the revision.
Sent from my iPad On 2011-06-01, at 12:46 PM, Daniele Testa <[email protected]> wrote: > Shouldn't that be up to the user? Why would the database protect me from that. > > You would have the same "problem" in all databases. If I edit a page > in a CMS and in the meantime that I change the things in the form, > some other user might have edit that same page. > > I don't see the problem why the user cannot specify something like > "_rev=latest". > > Personally, I find it very cumbersome to have to do a GET every time I > need to do a PUT. It also makes the update slower, as I need to do 2 > requests (sometimes over slow connections). > > Regards, > Daniele > > > 2011/6/1 Robert Newson <[email protected]>: >> We can't assume that, the document may have already changed between >> you reading it and updating it. >> >> http://guide.couchdb.org/editions/1/en/consistency.html >> >> B. >> >> On 1 June 2011 17:35, Daniele Testa <[email protected]> wrote: >>> Hi, >>> >>> I am new to this mailing list so please forgive me if this is a stupid >>> question. >>> >>> Why do I have to specify a revisionID when I do an update? >>> Can't couchdb just assume I meant to update the last revision if I >>> leave the revisionID empty? >>> >>> If I know that I want to update document with id=XYZ, do I have to >>> first do a GET/HEAD for that id to get the >>> last revision ID, and then run the PUT? >>> >>> I really hope there is a better way :) >>> >>> Regards, >>> Daniele >>> >>
