I deleted a document but I can still see it in _changes
, so I can see last valid _rev
, which is deleted, so get doc with id and last revision just returns:
{
"_id":"25efa4ec8489d8b89b34c5cad6000059",
"_rev":"3-a982bd6dccce8f405433f8453ab86880",
"_deleted":true
}
and no other attributes.
How can I recover in this situation? Previous revision can not be seen in _changes
. Will writing empty document (setting _deleted
to false
) help to see all revisions info?
Ok, figured it out, if anyone interested:
get deleted history, e.g.:
curl http://example.iriscouch.com/test/_changes
you'll see deleted documents with $id
and $rev
, put empty document as new version, e.g.:
curl -X PUT http://example.iriscouch.com/test/$id?rev=$rev -H "Content-Type: application/json" -d {}
now you can get all revisions info, e.g:
curl http://example.iriscouch.com/test/$id?revs_info=true
obtain version before deletion, e.g.:
curl http://example.iriscouch.com/test/$id?rev=$prev_rev
put it back to couchdb, e.g.:
curl -X PUT http://example.iriscouch.com/test/$id?rev=$rev -H \'Content-Type: application/json\' -d \'$data\'
Let me know if you have any better way, or script.