couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: delete Docs
Date Wed, 07 Apr 2010 13:15:25 GMT

On 7 Apr 2010, at 12:55, wolfgang haefelinger wrote:

> On Wed, Apr 7, 2010 at 12:25 PM, Jan Lehnardt <> wrote:
>>> of the resource in order to delete it. After all, the
>>> following appears to work fine (still using version 0.10 ):
>>> $ curl -X DELETE http://localhost:5984/mydb/myid?rev=whatever
>> You are saying are are able to delete a document by passing in a rev that doesn't
match the rev in the document? Can you create a reproducing test case for that?
> No, I'm not saying this. Where do you read that?

Sorry, I got that wrong. I interpreted `rev=whatever` as `rev=nonmatchingrev`.

> I'm stating that there is something fishy with "couchdb-python". As an
> example, I taking this line of code
> self.resource.delete_json(id, rev=headers['etag'].strip('"'))
> and I wonder about "delete_json()" - which does not make sense. I
> would expect  something like
> self.resource.delete(id, rev=headers['etag'].strip('"'))
> because a document's representation does not matter when deleting it.
> The original code is equivalent with
> $ curl -H "content-type: application/json" -X DELETE  ${url}
> Providing that mime-type is unnecessary however, cause this works fine:
> $ curl -X DELETE  ${url}

By default CouchDB replies with the `text/plain` mime-type to have browsers
render the JSON instead of offering it for download. If you send the
`application/json` mime-type with the request, CouchDB will also use it
with the response. So this is couchdb-python just making sure it gets
the correct mime-type returned. CouchDB's behaviour is nonstandard, 
but significantly better for usability.

Sorry for the earlier confusion.


View raw message