couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Fils <>
Subject Re: post design documents
Date Tue, 02 Jun 2009 17:05:03 GMT
  In other words...  RTFM   ;)

  Thanks...   I just dumped..   "_rev":"1-3118685883", (in my case) in 
before the "views" element in the JSON and it is working perfectly.  
Thanks!  For me in my case the race condition is not an issue. 

  Using the revs=true works nice too to get the current revisions and 
work that into a programmatic update of a design doc.  Obviously not 
something some one wants to do too often since view must be generated on 
first call, but nice for building up design docs with. 


Michael Stillwell wrote:
> On 2 Jun 2009, at 16:18, Douglas Fils wrote:
>> If a person modifies the code and wants to upload a new version how 
>> is that now done?  I tried PUT again and get a "Document update 
>> conflict" which I kinda expected.  Then I tried a POST which gave me 
>> back a 500 error.
>> Do you have to DELETE the URI then re-PUT it or is there a mechanism 
>> to update/version the design document?
> If you pass along the _rev of the *previous* version it will update as 
> you expect.  See:
> "To update an existing document, you also issue a PUT request. In this 
> case, the JSON body must contain a _rev property, which lets CouchDB 
> know which revision the edits are based on."
> Otherwise, if retrieving _rev is awkward, you can DELETE and re-add.  
> I don't know of a good way to handle the potential race conditions of 
> either case, if this is important to avoid.  (i.e. someone else 
> updates or adds your document before you get a chance to.)
> Michael

View raw message