How do I version control my map/reduce functions for CouchDB? I’d like to be able to check them into git/github so that my teammates can easily apply them to their local test environments. I know there the replicate features in CouchDB, but I’d like to keep the db views with the source for the project.
Share
What you need is one of the (many) couchapp tools. Basically they all map a bunch of js files in various structures to the design doc layout used by CouchDB, and usually provide some simple push/pull mechanisms to get these in and out.
You can then git init in the main folder & be sure you are versioning your uploaded design docs.
There’s a pretty good explanation http://mindeavor.com/blog/the-anatomy-of-a-couchapp just ignore the vendor/ discussion for the moment, its not required.
If you’re more of a JS/node guy try https://github.com/mikeal/node.couchapp.js/ or kanso http://kan.so/ is awesome but it does a lot more; you may find you need more Couch-fu before getting into it. It’s excellent however, you can get by just using
kanso pushto start with.If you just want to get started, use couchapp http://github.com/couchapp/couchapp which is a python tool, probably the original one.