You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by wh...@aol.com on 2010/08/10 19:43:56 UTC

how do views work with shows

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


Thanks,
Dan


 

 



Re: how do views work with shows

Posted by wh...@aol.com.
Everything from the Futon system.
I will start reading about lists.
Thanks,

Dan

 

 


 

 

-----Original Message-----
From: Dave Cottlehuber <da...@muse.net.nz>
To: user@couchdb.apache.org
Sent: Tue, Aug 10, 2010 10:58 am
Subject: Re: how do views work with shows


On 11 August 2010 05:43,  <wh...@aol.com> 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.



http://books.couchdb.org/relax/design-documents/shows

http://books.couchdb.org/relax/design-documents/design-documents

http://books.couchdb.org/relax/design-documents/lists

http://wiki.apache.org/couchdb/Formatting_with_Show_and_List



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

info.



A+

Dave


 

Re: how do views work with shows

Posted by Stephen Prater <st...@agrussell.com>.
I'd be interested in know how exactly you get cacheable lists and  
shows in a CouchApp.

I understand instantly why they'd be cacheable on the client side, and  
how you could do it with Squid,
but it seems like lists and shows wouldn't be cacheable to multiple  
clients in a pure CouchApp.

Am I missing something?

stephen

On Aug 10, 2010, at 12:58 PM, Dave Cottlehuber wrote:

> On 11 August 2010 05:43,  <wh...@aol.com> 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.
>
> http://books.couchdb.org/relax/design-documents/shows
> http://books.couchdb.org/relax/design-documents/design-documents
> http://books.couchdb.org/relax/design-documents/lists
> http://wiki.apache.org/couchdb/Formatting_with_Show_and_List
>
> 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
> info.
>
> A+
> Dave
>
>


Re: how do views work with shows

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 11 August 2010 05:43,  <wh...@aol.com> 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.

http://books.couchdb.org/relax/design-documents/shows
http://books.couchdb.org/relax/design-documents/design-documents
http://books.couchdb.org/relax/design-documents/lists
http://wiki.apache.org/couchdb/Formatting_with_Show_and_List

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
info.

A+
Dave