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:
http://wiki.apache.org/couchdb/HTTP_Document_API
"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