incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Kempf <jochenke...@gmail.com>
Subject Problems with reduce in view appear when record size > 6
Date Tue, 28 Jul 2009 00:33:48 GMT
Hi,

I am experiencing a problem when using a reduce in the following way:

First, I define a map function returning at least 4 values (here i define 6
values) -->

> function(doc) {
>   emit(doc["_id"], [doc["_id"], doc["_rev"], doc["var1"], doc["var2"],
> doc["var3"], doc["var4"], doc["var5"]]);
> }



Until here, everything works fine!
But once I define the following reduce function it stops working from 6 or 7
records on upwards (if the total record size of the corresponding database
is < 6 it works fine):

> function(key, values, combine) {
>         var ids = [];
>         var revs = [];
>         var variables = [];
>         for (i in values) {
>           ids.push(values[i][0]);
>           revs.push(values[i][1]);
>           variables.push([values[i][2], values[i][3], values[i][4],
> values[i][5], values[i][6]]);
>         }
>         return [ids, revs, variables];
>       }


This is the error message:

> Error: case_clause
>
{{badmatch,<<"Cannot encode 'undefined' value as JSON">>},
>  [{couch_query_servers,'-rereduce/3-fun-0-',3},
>   {lists,zipwith,3},
>   {couch_query_servers,rereduce,3},
>   {couch_view_group,'-init_group/4-fun-0-',4},
>   {couch_btree,'-write_node/3-lc$^0/1-0-',3},
>   {couch_btree,write_node,3},
>   {couch_btree,complete_root,2},
>   {couch_btree,query_modify,4}]}
>

Anyone knows what is going on?

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