You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by "Mantell, Christopher Arthur" <CM...@mgh.harvard.edu> on 2018/10/17 20:07:46 UTC

Bulk Undelete Documents From Database

Hi,


I accidentally deleted all the documents (except design documents) from my database and I wanted to get them back.  I was writing a script in Python using the CouchDB-python module.  I was also doing somethings with curl on the command line.


CouchDB Version = 2.2.0

Python Version = 2.7

Computer OS = Linux (CentOS 7 package)


In general, I was able to grab a list of the ids through /db/_changes.  I would then get these ids with revs=True and open_revs = 'all', which would return a list of revision ids and the current revision number.  However, I couldn't get the old document by doing a get request of the ids with rev=previous_revision number - they would return {"error":"not_found", "reason":"missing}.


I tried putting in an empty document back into the database with by doing a put request with one of those ids, which went through with a revision + 1.  With that document, I tried doing a get request with the previous revisions and I could get the current one and the one that was deleted but nothing before that - they would {"error":"not_found", "reason":"missing}.


The database on Fauxton says there is "just 4 docs and 1255 deleted docs."  Compaction doesn't run on this database (according to /couchip:5984/db/ - compact_running: false).  My understanding was that since these documents aren't purged and there's no compaction, I should be able to get the document data with the old revision numbers.


Any help would be greatly appreciated!


Thank you,


Chris



The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.