incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svilen ...@svilendobrev.com>
Subject Re: DELETE vs. _deleted:true
Date Mon, 01 Jul 2013 18:54:54 GMT
in my understanding DELETED is only a state in doc's existance, with
the extra's of returning 404 on GET (id) and hiding it from views.

All else is just as if it's yet another UPDATE - it stays forever,
appears in _changes, is replicated, can get it via id+rev etc.
(e.g. update-validations have to ignore those ._deleted or will
probably fail)

Also UPDATE( _deleted=true) for _users/* works better / is more
consistent than DELETEing those.

it would be good if all this is mentioned in clear text in the docs -
as there's no "delete" really.


On Mon, 1 Jul 2013 11:32:32 -0700
Stephen Bartell <snbartell@gmail.com> wrote:

> Excellent! Thanks guys
> On Jul 1, 2013, at 11:31 AM, Alexander Shorin <kxepal@gmail.com>
> wrote:
> 
> > 1. Correct.
> > 2. Correct.
> > 
> > With setting `_deleted: true` it's possible to keep existed or set
> > some additional information about deletion. For instance:
> > 
> >> curl -XPUT
> >> http://localhost:5984/db/docid\?rev\=2-541a08c89aef73030c0af847ce79d65d
> >> -d '{"_deleted": true, "reason": "deprecated"}' -H
> >> "Content-Type:application/json"
> > {"ok":true,"id":"docid","rev":"3-2b7c72ba9c17487f4b646efcaf740e2b"}
> >> curl
> >> http://localhost:5984/db/docid\?rev\=3-2b7c72ba9c17487f4b646efcaf740e2b
> > {"_id": "docid", "_rev": "3-2b7c72ba9c17487f4b646efcaf740e2b",
> > "_deleted": true, "reason": "deprecated"}
> > 
> > --
> > ,,,^..^,,,
> > 
> > 
> > On Mon, Jul 1, 2013 at 10:21 PM, Stephen Bartell
> > <snbartell@gmail.com> wrote:
> >> Quick question on deleting.
> >> 
> >> Are the following assumptions correct:
> >> 
> >> 1. If i use the DELETE verb, a delete handler is invoked in which
> >> the following operations will render the doc deleted: a) All data
> >> except `_id`, and `_rev` is stripped from the doc b) a field
> >> `_deleted` is set to true.
> >> 
> >> 2. If I take a doc and create the `_deleted` field and set it to
> >> true myself, then the doc is deleted; even though all data except
> >> _id and _rev are still present.
> >> 
> >> Thanks,
> 

Mime
View raw message