Search code examples
couchdbcouchbasecouchdb-futon

What is the best way to write/manage views in couchdb?


So we've starting using couchdb at work. Writing javascript functions in futon is no fun. I want to be able to write them in a text editor. I'd also like to be able to easily write my functions, push them to a dev database, and then push them to test/prod. Help?!


Solution

  • http://couchapp.org

    Even if you aren't creating a typical couchapp (a web application served from CouchDB), I've found it to be a useful tool for the needs you describe.

    A minimal couchapp allows you to organize each of your view, list, show, filter, and update functions as their own .js file, in a directory structure that makes sense. It takes care of JSON-encoding during a push, and assembling all of the files into a _design document. This allows you to easily use typical version control practices. It also supports other SCM practices, like enabling configurations for pushing to different environments. This avoids most of the hassles of Futon, which is not a very practical tool for managing your JavaScript functions in CouchDB.