Don't you need a comma between map and reduce fields?
On Saturday, December 11, 2010, Chris Johnson <[email protected]> wrote: > 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 >
