incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cottlehuber <>
Subject Re: how do views work with shows
Date Tue, 10 Aug 2010 17:58:43 GMT
On 11 August 2010 05:43,  <> wrote:
> I'm having trouble understanding what you do with a view.
> There are shows and views but there is seemingly no link
> between them.
> A view will give you back a json information.
> A show will render a web page with body and header info
> but how do you get a view to work with a show

You don't as far as I know. quotes from TDG.

just remember: lists are to views, as shows are to docs. same purpose,
different scope.

"Just as show functions convert documents to arbitrary output formats,
CouchDB list functions  allow you to render the output of view queries
in any format. The powerful iterator API allows for flexibility to
filter and aggregate rows on the fly, as well as outputting raw
transformations for an easy way to make Atom feeds, HTML lists, CSV
files, config files, or even just modified JSON."

lists are good for summary data across multiple docs:
doc (single JSON doc) -> view (map-reduced values from many docs, in
JSON)  -> list (transformed JSON in any format you like)

"Because a show function will always return the same result given the
same input, and can’t change anything about the environment in which
it runs, it’s output can be cached and intelligently reused."

shows are designed to be cacheable & side effect free - so they can
operate only on a single doc
doc (single JSON doc) -> show (transformed JSON in any format you like)

This is covered later in the book in more detail.

I hope I got that right.

BTW re your previous email, are you doing this in Futon, from a
command line with curl, how are you uploading the JSON? Give us more


View raw message