1) A view has a name which needs to be unique in a design document. Other than that there is no problem storing multiple views in a single design document. I recommend managing you design documents using CouchApp (also makes it easy to manage your design documents in a version control system): http://groups.google.com/group/couchapp
2) See the documentation for the HTTP View API for what parameters you can pass to views: http://wiki.apache.org/couchdb/HTTP_view_API You might also want to check out list and show functions, which add extra flexibility on top of views: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List Nils. ________________________________________ Van: Michael W [[email protected]] Verzonden: vrijdag 26 februari 2010 16:11 Aan: [email protected] Onderwerp: Understanding views Hi everybody, I just started to get familiar with couchDB. One of the most important resource of my research is the draft of O'Reily's book on couchDB. I belive I've got a pretty good overview on how couchDB works but there still some questions regarding views which I hope you can help me to answer. 1) According to the documentation (if I understand correctly) views can be stored only in design documents and running ad-hoc views is slower than running pre-defined views (from the ddoc). How can I create multiple views in one ddoc? A real-life app wil probably need dozens views and I guess it's not the recommended way to store each of them in a single ddoc, is it? 2) How can I pass additional parameters to a view? Consider an application where the user needs to log in and the user id is stored somewhere in the session object. Now I want to query couchDB to get all documents of a specific type which the current user has created. How could I pass that user id to the view function? Thank you very much in advance for answering my questions. Have a nice weekend! Michael De informatie vervat in deze e-mail en meegezonden bijlagen is uitsluitend bedoeld voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden e-mail, noch voor tijdige ontvangst daarvan.
