View: Map reduce queries

class couchdbreq.view.View(db, view_path, schema=None, params=None)[source]

An iterable object representing a query.

Do not construct directly. Use couchdbreq.Database.view(), couchdbreq.Database.all_docs() or couchdbreq.view.View.filter().

all()[source]

Get a list of all rows

Returns:list
count()[source]

Return the number of results

Returns:int
filter(startkey=<object object>, endkey=<object object>, keys=<object object>, key=<object object>, startkey_docid=<object object>, endkey_docid=<object object>, skip=<object object>, limit=<object object>, inclusive_end=<object object>)[source]

Return a new View object with updated query parameters. The original View object remains unchanged.

Returns:A new couchdbreq.view.View object
first(is_null_exception=False)[source]

Return the first result of this query or None if the result doesn’t contain any rows.

Parameters:is_null_exception – If True then raise couchdbreq.exceptions.NoResultFound if no results are found.
Returns:A dict representing the row result or None
one(is_null_exception=False)[source]

Return exactly one result or raise an exception if multiple results are found.

Parameters:is_null_exception – If True then raise couchdbreq.exceptions.NoResultFound if no results are found.
Returns:A dict representing the row result or None