I figured out how to do this. Tell me if this is correct:
1. Define a view in CouchDB (server side).
2. Replicate from CouchDB to PouchDB. This brings the view design into the local PouchDB inside my browser.
3. In my local js, do this: db.query('myAppName/myViewName ' ... to execute the view.
4. This works for me when using idb:// against local data and when using http:// against the server side data. I can just change my datasource when I connect: Pouch(datasource...).
Is this the expected use case? In other words:
1. Create a couchapp, including views, and deploy it to CouchDB.
2. Replicate that db to a PouchDB instance.
3. Consume views on the client using db.query.
What's a little weird (to me) is that my "code" comes down to the browser in 2 different ways. Some of it comes via a regular http get from the browser just getting the html and js from the server (which I then cache using html5 appcache manifest), while the views (which are really more code) come down using replication. I guess if I don't like that I can just use temp views against idb, which perform the same anyway and just use replication for data.
Thanks for any confirmation / opinion / comments.
Colin