Fork me on GitHub

costco is a small UI for bulk editing and adding CouchDB documents. It takes a map function and uses it to edit all the docs in the database, alternately it takes an array of JSON objects and adds them to the db.

For convenience it's a couchapp, so you can push it to any db like so:

git clone http://github.com/harthur/costco.git
cd costco
couchapp push . http://hostname:5984/mydatabase
and visit it at http://hostname:5984/mydatabase/_design/costco/index.html

Examples
editing docs
change the error field of all docs
function(doc) {
  doc.error *= 100;
  return doc;
}
rename message field in all docs
function(doc) {
  doc.text = doc.message;
  delete doc.message;
  return doc;
}     
	
deleting docs
delete all docs that have year less than 2010
function(doc) {
  if(doc.year < 2010)
    return null;
}     
	
cut docs in db down to the first thousand
function(doc) {
  i = i + 1 || 1;

  if(i > 1000)
    return null;
}
                   
adding docs
add a doc to the db
{
  "name": "newdoc",
  "message": "addin"
}
	
add three docs to the db
{"name": "doc1","message": "addin"},
{"name": "doc2", "count": 20},
{"name": "doc3", "count": 14}