CCCP — CouchDB Curl Copy
A small demo app that shows how you can do fun maintenance tasks with common UNIX tools.
curl $COUCHDBDATABSE | curl -X POST $ANOTHERCOUCHDBDATABASE
How it Works
The key is in
lists/bulk_docs.js; It transforms a view result into a JSON
object that the CouchDB
_bulk_docs API understands.
The rest of this app is just supporting the showcase:
views/all/map.jsis a sample view that just lists all documents.
_docsare a bunch of example documents.
bulk.shis a test script that shows how to invoke the mighty
What is this good for?
Say you want to modify all your documents in one swoop:
- Write a view that emits a value with whatever your docs should look like.
- Add cccp’s list function to the database.
- Do the
curl | curldance and you’re done.
Let me know if you have other uses for this.