Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between show and list functions

What is the difference between a show and a list function and what is the purpose for them?

I'm studying CouchDB right now and reading bunch of different tutorials for CouchDB but this question never was explained carefully. (at least I didn't find it)

like image 217
Kuepper Avatar asked Jun 18 '11 14:06

Kuepper


People also ask

What does list() function do in Python?

The list() function creates a list object. A list object is a collection which is ordered and changeable. Read more about list in the chapter: Python Lists.

How do you create a list inside a function in Python?

In any programming language, lists are used to store more than one item in a single variable. In Python, we can create a list by surrounding all the elements with square brackets [] and each element separated by commas. It can be used to store integer, float, string and more.


1 Answers

A _show function is meant to transform a single document, while a _list function is meant to transform the results of a view.

Both of them are meant to take the data within your document(s) and transform them into some other format. For example, you can render as HTML, XML or any other format you specify via the content-type header. By doing this on the database itself, you can reduce some of the work your application layer needs to perform.

Also, there are ways to use _list functions to do additional filtering and transformation to view results, allowing for a lot more flexibility than a typical view.

like image 184
Dominic Barnes Avatar answered Sep 20 '22 06:09

Dominic Barnes