This is my view map and reduce function:
server": {
"map": "function(doc) { if (doc.type ==
'performance_stats') emit([doc.test_id, doc.Hostname],null ) }",
"reduce": "function(keys, values) {return (null)}"
},
And it works on one of my other hosts running couchdb(older version).
Here is the response:
{"rows":[
{"key":["ViPR_1.1_test2","10.247.98.206"],"value":null},
{"key":["ViPR_1.1_test2","10.247.98.207"],"value":null},
{"key":["ViPR_1.1_test2","10.247.98.208"],"value":null},
{"key":["ViPR_1.1_test2","10.247.98.209"],"value":null},
{"key":["ViPR_1.1_test2","10.247.98.210"],"value":null}
]}
-----Original Message-----
From: Alexander Shorin [mailto:[email protected]]
Sent: Friday, November 07, 2014 2:34 AM
To: [email protected]
Subject: Re: Couchdb view error
Make sure that the value your map function emits is a number, not a strings or
something else.
--
,,,^..^,,,
On Fri, Nov 7, 2014 at 5:26 AM, Ramanadham, Radhika
<[email protected]> wrote:
> Hi,
>
> I have couchdb running on a linux host. I have a database created and a few
> design documents created.
>
> I don't know for one view which I run, I get an error and I don't know why.
> It was working fine before and I had to stop my code, delete the DB from
> futon and rerun createdb and started form there.
>
> http://lglod193.lss.emc.com:5984/longevity/_design/perfstats/_view/ser
> ver?group=true&startkey=[%22ViPR_1.1_test2%22]&endkey=[%22ViPR_1.1_tes
> t2%22,{}<http://lglod193.lss.emc.com:5984/longevity/_design/perfstats/
> _view/server?group=true&startkey=%5b%22ViPR_1.1_test2%22%5d&endkey=%5b
> %22ViPR_1.1_test2%22,%7b%7d>]
>
> Looking at couch.log, I see this error. Anybody can help me? It doesn't work
> only on this box. Anyother host I try, it works.
>
> [Fri, 07 Nov 2014 02:14:49 GMT] [error] [emulator] Error in process
> <0.5843.0> with exit value:
> {function_clause,[{couch_query_servers,builtin_stats,[reduce,[[[<<19
> bytes>>,<<67 bytes>>],<<2 bytes>>],[[<<19 bytes>>,<<67 bytes>>],<<2
> bytes>>],[[<<19 bytes>>,<<67 bytes>>],<<2 bytes>>],[[<<19 bytes>>,<<67
> bytes>>],<<2 bytes>>],[[<<19 bytes>>,<<67 bytes>>],<<2 bytes>>],[[<<19
> bytes>>,<<67 bytes>>],<<1 byte>>],[[<<19 bytes>>,<<67 bytes>>],<<1
> byte>>],[[<<19 bytes>>,<<67 bytes>>],<<1 byte>>],[[<<19 bytes>>,<<67
> bytes>>],<<2
> bytes>>]]],[{file,"couch_query_servers.erl"},{line,202}]},{couch_query_servers,builtin_reduce,4,[{file,"couch_quer...
>
>
> [Fri, 07 Nov 2014 02:14:49 GMT] [error] [<0.107.0>] {error_report,<0.31.0>,
> {<0.107.0>,crash_report,
> [[{initial_call,
> {mochiweb_acceptor,init,
> ['Argument__1','Argument__2','Argument__3']}},
> {pid,<0.107.0>},
> {registered_name,[]},
> {error_info,
> {error,badarg,
> [{erlang,list_to_binary,
> [[{couch_query_servers,builtin_stats,
> [reduce,
> [[[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_lglom208.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"36">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_lglom210.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"36">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_lglom232.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"30">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_lglom236.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"37">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_lglom237.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"36">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_losar161.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"0">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_losar162.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"0">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_losar163.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"0">>],
> [[<<"SRMSuite_3.5_cycle2">>,
>
> <<"server_losar164.lss.emc.com_SRMSuite_3.5_cycle2_2014-11-06 21:00:00">>],
> <<"49">>]]],
> [{file,"couch_query_servers.erl"},{line,202}]},
> {couch_query_servers,builtin_reduce,4,
> [{file,"couch_query_servers.erl"},{line,174}]},
> {couch_query_servers,reduce,3,
> [{file,"couch_query_servers.erl"},{line,132}]},
> {couch_mrview_util,'-open_view/5-fun-0-',4,
> [{file,"src/couch_mrview_util.erl"},
> {line,220}]},
> {couch_btree,'-write_node/3-lc$^0/1-0-',5,
> [{file,"couch_btree.erl"},{line,362}]},
> {couch_btree,write_node,3,
> [{file,"couch_btree.erl"},{line,356}]},
> {couch_btree,modify_node,4,
> [{file,"couch_btree.erl"},{line,325}]},
> {couch_btree,query_modify,4,
> [{file,"couch_btree.erl"},{line,196}]}]],
> []},
> {couch_httpd,error_info,1,
> [{file,"couch_httpd.erl"},{line,818}]},
> {couch_httpd,send_error,2,
> [{file,"couch_httpd.erl"},{line,925}]},
> {couch_httpd,handle_request_int,5,
> [{file,"couch_httpd.erl"},{line,353}]},
> {mochiweb_http,headers,5,
> [{file,"mochiweb_http.erl"},{line,94}]},
> {proc_lib,init_p_do_apply,3,
> [{file,"proc_lib.erl"},{line,239}]}]}},
> {ancestors,
> [couch_httpd,couch_secondary_services,
> couch_server_sup,<0.32.0>]},
> {messages,[]},
> {links,[<0.104.0>,#Port<0.3089>]},
> {dictionary,
> [{mochiweb_request_qs,
> [{"group","true"},
> {"startkey","[\"SRMSuite_3.5_cycle2\"]"},
> {"endkey","[\"SRMSuite_3.5_cycle2\",{}]"}]},
> {couch_rewrite_count,0},
> {mochiweb_request_cookie,[]}]},
> {trap_exit,false},
> {status,running},
> {heap_size,6772},
> {stack_size,27},
> {reductions,102693}],
> []]}}
> lglod193:/var/log/couchdb #
>
>
> Can anybody help what's wrong here?
>
> Thanks,
> Radhika