couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Williams <thomas.willi...@dubitlimited.com>
Subject Re: views don't work
Date Thu, 24 Sep 2009 12:06:37 GMT
Hi Oliver,You need to compose a view of a couple of sub elements. "map" and
"reduce". So assuming that you were just attempting this as a temporary
query (rather than a stored one) you'd need to POST the following:

{
"map": function(doc) {
 emit(null, doc);
}}

The differences between the "map", and the "reduce" fields is described here
http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views and there's
more detail on the http API here:
http://wiki.apache.org/couchdb/HTTP_view_API

Happy querying,
Tom

2009/9/24 Oliver Oli <oliver.oli+0815@gmail.com<oliver.oli%2B0815@gmail.com>
>

> I'm running couchdb 0.9.1. Everything worked fine until I tried my first
> view:
>
> test.js:
>
> function(doc) {
>  emit(null, doc);
> }
>
> {"error":"error","reason":"{function_clause,\n
> [{couch_view_group,'-design_doc_to_view_group/1-fun-0-',\n
> [{<<\"test\">>,<<\"function(doc) {\\n  emit(null, doc);\\n}\">>},\n
>      {dict,0,16,16,8,80,48,\n
> {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},\n
> {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}]},\n
> {lists,foldl,3},\n
> {couch_view_group,design_doc_to_view_group,1},\n
> {couch_view_group,open_db_group,2},\n
> {couch_view_group,prepare_group,2},\n     {couch_view_group,init,1},\n
>    {gen_server,init_it,6},\n     {proc_lib,init_p_do_apply,3}]}"}
>
> i have no clue what couchdb is trying to tell me
>



-- 
Thomas Williams
Java Programmer
Dubit Limited
+44 1133 947920
www.dubitlimited.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message