incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Rudyk" <alex.ru...@gmail.com>
Subject Re: Why I have to know _rev to DELETE document?
Date Thu, 15 Jan 2009 18:41:34 GMT
It's a code snippet from couch_httpd.erl

db_doc_req(#httpd{method='DELETE'}=Req, Db, DocId) ->
    case extract_header_rev(Req, couch_httpd:qs_value(Req, "rev")) of
    missing_rev ->
        couch_httpd:send_error(Req, 412, <<"missing_rev">>,
            <<"Document rev/etag must be specified to delete">>);
    RevToDelete ->
        {ok, NewRev} = couch_db:delete_doc(Db, DocId, [RevToDelete]),
        send_json(Req, 200, {[
            {ok, true},
            {id, DocId},
            {rev, NewRev}
            ]})
    end;

Looks like exception will be thrown if no revision specified.

So I think _rev is mandatory parameter for DELETE.

2009/1/15 Noah Slater <nslater@apache.org>:
> On Thu, Jan 15, 2009 at 08:36:46AM -0800, Alex Rudyk wrote:
>> Also why client may want to delete revision that is not last/current
>> revision of the document?
>
> Document revisions may not mean what you think they mean:
>
>  http://wiki.apache.org/couchdb/Document_revisions
>
> Hope this helps,
>
> --
> Noah Slater, http://tumbolia.org/nslater
>

Mime
View raw message