Skip to content

Instantly share code, notes, and snippets.

View csgui's full-sized avatar
💻
Coding...

Chris Guimarães csgui

💻
Coding...
View GitHub Profile
@vjt
vjt / couchdb-undelete.rb
Last active December 24, 2019 07:04
Undeletes a document from a CouchDB database.
#!/usr/bin/env ruby
#
# Undelete a document from a CouchDB database.
#
# Recovers a previously deleted document by looking at the _changes
# feed, putting a new empty document preserving the revisions chain,
# retrieves the revs_info for the document, asks the user which one
# to recover, and puts back the old revision into place.
#
# For this to work, GETting the document must return error: "not_found",