incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Kuleshov <akules...@tpip.net>
Subject {case_clause,{error,[],function_clause}} in CouchDb-1.2.0
Date Thu, 27 Jun 2013 14:38:04 GMT
Hello,

I'm trying to use Couchdb-1.2.0 with Couchbeam.

I create database, documents and etc...

I have a view:

{
   "_id": "_design/task",
   "_rev": "1-0ba3c64c158deb66749cf23aaee9e855",
   "language": "erlang",
   "views": {
       "by_task_creation": {
           "map": "fun({Doc}) ->\n\tcase couch_util:get_value(<<\"_id\">>,
Doc, null) of\n\t    TaskId = <<\"task:\", _/binary>> ->\n\t\tcase couch_util:get_value(<<\"created\">>,
Doc, null) of\n\t\t    null -> ok;\n\t\t    Created -> Emit(Created, null)\n\t\tend;\n\t
   _ -> ok\n\tend\nend.\n",
           "reduce": "fun(_Keys, Values, false) -> length(Values);\n   (_Keys, Values,
true)  -> lists:sum(Values) end.\n"
       },
       "by_task_selector": {
           "map": "fun({Doc}) ->\n\tcase couch_util:get_value(<<\"_id\">>,
Doc, null) of\n\t    TaskId = <<\"task:\", _/binary>> ->\n\t\tcase couch_util:get_value(<<\"selector\">>,
Doc, null) of\n\t\t    null -> ok;\n\t\t    Selector -> Emit(Selector, TaskId)\n\t\tend;\n\t
   _ -> ok\n\tend\nend.\n"
       }
   }
}

But when i'm trying to fetch it i got error:

{case_clause,{error,[],function_clause}}

I'm trying with: couchbeam_view:fetch(DB, {<<"_design/task">>, <<"by_task_creation">>},
[{reduce, true}]) 

How can i make it correctly?

Thank you.

Mime
View raw message