all/1 | fetch all docs. |
all/2 | fetch all docs. |
count/1 | Equivalent to count(Db, all_docs, []). |
count/2 | Equivalent to count(Db, ViewName, []). |
count/3 | count number of doc in a view (or all docs). |
fetch/1 | Equivalent to fetch(Db, all_docs, []). |
fetch/2 | Equivalent to fetch(Db, ViewName, []). |
fetch/3 | Collect view results. |
first/1 | Equivalent to first(Db, all_docs, []). |
first/2 | Equivalent to first(Db, ViewName, []). |
first/3 | get first result of a view. |
fold/4 | Equivalent to fold(Function, Acc, Db, ViewName, []). |
fold/5 | call Function(Row, AccIn) on succesive row, starting with AccIn == Acc. |
foreach/3 | Equivalent to foreach(Function, Db, ViewName, []). |
foreach/4 | call Function(Row) on succesive row. |
parse_view_options/1 | parse view options. |
stream/2 | Equivalent to stream(Db, all_docs, Client, []). |
stream/3 | Equivalent to stream(Db, ViewName, Client, []). |
stream/4 | stream view results to a pid. |
view_loop/2 |
all(Db::db()) -> {ok, Rows::[ejson_object()]} | {error, term()}
Equivalent to fetch(Db, all_docs, []).
fetch all docs
all(Db::db(), Options::view_options()) -> {ok, Rows::[ejson_object()]} | {error, term()}
Equivalent to fetch(Db, all_docs, Options).
fetch all docs
count(Db::db()) -> integer() | {error, term()}
Equivalent to count(Db, all_docs, []).
count(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}) -> integer() | {error, term()}
Equivalent to count(Db, ViewName, []).
count(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Options::view_options()) -> integer() | {error, term()}
count number of doc in a view (or all docs)
fetch(Db::db()) -> {ok, Rows::[ejson_object()]} | {error, term()}
Equivalent to fetch(Db, all_docs, []).
fetch(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}) -> {ok, Rows::[ejson_object()]} | {error, term()}
Equivalent to fetch(Db, ViewName, []).
fetch(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Options::view_options()) -> {ok, Rows::[ejson_object()]} | {error, term()}
Collect view results
Db: a db record
ViewName: 'all_docs'
to get all docs or {DesignName,
ViewName}
Options :: view_options() [{key, binary()} | {start_docid, binary()} | {end_docid, binary()} | {start_key, binary()} | {end_key, binary()} | {limit, integer()} | {stale, stale()} | descending | {skip, integer()} | group | {group_level, integer()} | {inclusive_end, boolean()} | {reduce, boolean()} | reduce | include_docs | conflicts | {keys, list(binary())}
See couchbeam_view:stream/4
for more information about
options.
Return: {ok, Rows} or {error, Rows, Error}
first(Db::db()) -> {ok, Row::ejson_object()} | {error, term()}
Equivalent to first(Db, all_docs, []).
first(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}) -> {ok, Row::ejson_object()} | {error, term()}
Equivalent to first(Db, ViewName, []).
first(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Options::view_options()) -> {ok, Rows::ejson_object()} | {error, term()}
get first result of a view
Db: a db record
ViewName: 'all_docs' to get all docs or {DesignName, ViewName}
Options :: view_options() [{key, binary()} | {start_docid, binary()} | {end_docid, binary()} | {start_key, binary()} | {end_key, binary()} | {limit, integer()} | {stale, stale()} | descending | {skip, integer()} | group | {group_level, integer()} | {inclusive_end, boolean()} | {reduce, boolean()} | reduce | include_docs | conflicts | {keys, list(binary())}
See couchbeam_view:stream/4
for more information about
options.
Return: {ok, Row} or {error, Error}
fold(Function::function(), Acc::list(), Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}) -> [term()] | {error, term()}
Equivalent to fold(Function, Acc, Db, ViewName, []).
fold(Function::function(), Acc::list(), Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Options::view_options()) -> [term()] | {error, term()}
call Function(Row, AccIn) on succesive row, starting with AccIn == Acc. Function/2 must return a new list accumultator or the atom done to stop fetching results. Acc0 is returned if the list is empty. For example:
couchbeam_view:fold(fun(Row, Acc) -> [Row|Acc] end, [], Db, 'all_docs').
foreach(Function::function(), Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}) -> [term()] | {error, term()}
Equivalent to foreach(Function, Db, ViewName, []).
foreach(Function::function(), Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Options::view_options()) -> [term()] | {error, term()}
call Function(Row) on succesive row. Example:
couchbeam_view:foreach(fun(Row) -> io:format("got row ~p~n", [Row]) end, Db, 'all_docs').
parse_view_options(Options::list()) -> view_query_args()
parse view options
stream(Db::db(), Client::pid()) -> {ok, StartRef::term(), ViewPid::pid()} | {error, term()}
Equivalent to stream(Db, all_docs, Client, []).
stream(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Client::pid()) -> {ok, StartRef::term(), ViewPid::pid()} | {error, term()}
Equivalent to stream(Db, ViewName, Client, []).
stream(Db::db(), ViewName::all_docs | {DesignName::string(), ViewName::string()}, Client::pid(), Options::view_options()) -> {ok, StartRef::term(), ViewPid::pid()} | {error, term()}
stream view results to a pid
Db: a db record
ViewName: 'all_docs' to get all docs or {DesignName, ViewName}
Client: pid where to send view events where events are:
Options :: view_options() [{key, binary()} | {start_docid, binary()} | {end_docid, binary()} | {start_key, binary()} | {end_key, binary()} | {limit, integer()} | {stale, stale()} | descending | {skip, integer()} | group | {group_level, integer()} | {inclusive_end, boolean()} | {reduce, boolean()} | reduce | include_docs | conflicts | {keys, list(binary())}
{key, Key}
: key value{start_docid, DocId}
: document id to start with (to allow pagination
for duplicate start keys{end_docid, DocId}
: last document id to include in the result (to
allow pagination for duplicate endkeys){start_key, Key}
: start result from key value{end_key, Key}
: end result from key value{limit, Limit}
: Limit the number of documents in the result{stale, Stale}
: If stale=ok is set, CouchDB will not refresh the view
even if it is stale, the benefit is a an improved query latency. If
stale=update_after is set, CouchDB will update the view after the stale
result is returned.descending
: reverse the result{skip, N}
: skip n number of documentsgroup
: the reduce function reduces to a single result
row.{group_level, Level}
: the reduce function reduces to a set
of distinct keys.{reduce, boolean()}
: whether to use the reduce function of the view. It defaults to
true, if a reduce function is defined and to false otherwise.include_docs
: automatically fetch and include the document
which emitted each view entry{inclusive_end, boolean()}
: Controls whether the endkey is included in
the result. It defaults to true.conflicts
: include conflicts{keys, [Keys]}
: to pass multiple keys to the view query Return {ok, StartRef, ViewPid}
or {error,
Error}
. Ref can be
used to disctint all changes from this pid. ViewPid is the pid of
the view loop process. Can be used to monitor it or kill it
when needed.
view_loop(UserFun, Params) -> any()
Generated by EDoc, Aug 31 2012, 10:02:31.