Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for 
change notification.

The following page has been changed by ChrisAnderson:
http://wiki.apache.org/couchdb/Formatting_with_Show_and_List

The comment on the change is:
documented show functions

New page:
The basics of formatting documents using `show` and `list` functions. These 
functions convert documents and views, respectively, into non-JSON formats. The 
rows of each view are processed individually, which keeps long lists from 
becoming memory hogs.

They are designed to be cacheable. CouchDB handles generating Etags for show 
and list responses.

Show and list functions are side effect free and idempotent. They can not make 
additional HTTP requests against CouchDB. Their purpose is to render JSON 
documents in other formats.

== Showing Documents ==

Show functions are stored in your design document, under the `shows` key. 
Here's an example set of show functions:

{{{
{
"_id" : "_design/examples",
"shows" : {
  "posts" : "function(doc, req) {... return responseObject;}",
  "people" : "function(doc, req) { ... }"
}
}}}

These functions could be queried like this:

{{{
GET /db/_show/examples/posts/somedocid

GET /db/_show/examples/people/otherdocid

GET /db/_show/examples/people/otherdocid?format=xml&details=true
}}}


The show function is run with two arguments, the first is the document 
corresponding to the requested docid. The second argument is the req object, 
which contains information about the query string, Accept headers, and other 
per-request information.

The show function returns a JSON object of the same format of the _external 
response. See ExternalProcesses for further explanation of the `req` object as 
well as documentation about the response.

== Listing Views ==

Reply via email to