incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Johnson <csj...@yahoo.com>
Subject Re: setting up reduce function... error on import
Date Sun, 12 Dec 2010 01:07:44 GMT
That is exactly what the problem was. Thank you

> ------------------------------------------------------------------------
>
> 	Ning Tan <mailto:ningtan@gmail.com>
> December 11, 2010 1:12 PM
>
>
> Don't you need a comma between map and reduce fields?
>
> ------------------------------------------------------------------------
>
> 	Chris Johnson <mailto:csj790@yahoo.com>
> December 11, 2010 12:56 PM
>
>
> I am new to couch and trying to get my arms around the map/reduce 
> function. I am using exmaples from the web as well as the tutorials in 
> the O'Reilly book as a guide. I have an understanding of the map 
> function, but when I try to introduce the reduce function to my file I 
> get a bad request error when I try to import it.
>
> {"error":"bad_request","reason":"invalid UTF-8 JSON"}
>
> Basically what I am doing is importing a session table from a firewall 
> into couch and then using a reduce function to count the number of 
> sessions for a given host. What I have is
>
> {
>     "_id" : "_design/example",
>     "_rev" : "8-849766ce1eb8eedaa2353a408a3aaaf2",
>     "views" : {
>         "foo" : {
>             "map" : "function(doc){
>                 if(doc.in_dstPort == '443') emit(doc.in_dstIP, 1);
>             }"
>
>             "reduce" : "function(key, values, rereduce){
>                 return sum(values);
>             }"
>
>         }
>     }
> }
>
> I have narrowed it down the to the reduce function but just cant seem 
> to isolate the issue. I know it is something minor that I am missing.
>
> Thanks in advance for your help

Mime
View raw message