You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Oliver Oli <ol...@gmail.com> on 2009/09/24 13:03:49 UTC

views don't work

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

Re: views don't work

Posted by Thomas Williams <th...@dubitlimited.com>.
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 <ol...@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