Add support for views

I recreate the PR to support views in CouchDB.
See #2 (original pull request)