couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eiri <e...@eiri.ca>
Subject Re: Get a deleted doc back: v 2.0.0
Date Tue, 21 Feb 2017 14:19:05 GMT

Hi John,

You can get the info you are looking for by quering your deleted doc with parameters open_revs
set to all and revs set to true. I’m not sure how setting doc’s field _deleted worked
for you, default doc_validation should’ve stop it, but those parameters should work anyway.

And revs_info provides detailed info on the all revisions for “available" docs, I’ve created
a short gist to demo all those cases, hope it’ll help.

https://gist.github.com/eiri/a40bcb2eb9a8b1752d604948e052be04

Regards,
Eric. 



> On Feb 21, 2017, at 08:59, John Le Brasseur <johnlebrasseur@gmail.com> wrote:
> 
> Thank you Max.
> I will get there eventually.
> What worries me in this case is that the previous revision number( rev-1 in
> this case) is not available.
> I did not compact the database.
> In other databases I have checked, documents have for instance 6 revisions
> with all 6 revision numbers available although not all docs are recoverable.
> Thanks again.
> I appreciate it.
> 
> 
> On 21 February 2017 at 12:30, max <maxima078@gmail.com> wrote:
> 
>> Hi,
>> 
>> Use _changes on the database you'll see your deleted doc with the 'deleted
>> : true' then grep the last revision. From here you'll be able to get your
>> document with this specific (last) revision (?rev=xxxxxxxx).
>> If you add the query parameter revs=true couchdb add the "_revisions"
>> property and you should be able to get any available revision.
>> 
>> Regards,
>> 
>> Max.
>> 
>> 2017-02-20 12:18 GMT+01:00 John Le Brasseur <johnlebrasseur@gmail.com>:
>> 
>>> Hi.
>>> Just to be absolutely sure.
>>> I added "_deleted:true" into a document in fauxton.
>>> Fine.
>>> Using the command line I used GET.../db/doc?revs_info=true the answer is
>> :
>>> {"error":"not_found","reason":"deleted"}
>>> 
>>> OK
>>> 
>>> So this means there is no _previous_ revision information available.
>>> 
>>> (_changes info gives the last _rev)
>>> 
>>> To be clear this means that without a backup of the database, the
>> document
>>> _cannot_ be rescued?
>>> 
>>> In this case I created a new document, and added the previous data which
>> I
>>> obtained from my backup database.
>>> 
>>> 
>>> Are my statements correct and was my method correct and the only way out?
>>> 
>>> 
>>> I did find the option "db/doc?open_revs=true" which did give me the
>>> previous information.
>>> 
>>> Would this then be the first option?
>>> 
>>> (Should I not have added "_deleted: true" into Fauxton but rather have
>>> deleted the document in another way?(clicking and deleting, or using curl
>>> from the command line) or should the previous revision number have been
>>> present? I would have thought so. I have not compacted or
>>> anything.("compact_running": false)))
>>> 
>>> 
>>> Many thanks.
>>> 
>>> John
>>> 
>> 
> 
> 
> 
> John


Mime
View raw message