incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad King" <brk...@gmail.com>
Subject views with reduce functions
Date Thu, 17 Jul 2008 21:44:30 GMT
I have a view with a simple reduce function to count some attributes
in the doc. It runs fine in Futon, but when I call it directly, it
doesn't return any results. I've checked my spelling like 8 times, and
other views I have are working just fine. Am I missing something
obvious?

{
   "count": {
       "map": "function(doc) {\n
if(doc.entityobject.Attributes.Manufacturer != \"\")\n
emit(doc.entityobject.Attributes.Manufacturer, 1);\n}",
       "reduce": "function(keys, values) { \n  return sum(values); \n}"
   }
}

In Futon this returns a bunch of manufacturer count data as expected.
I then call from this URL

http://myserver:5984/inventorytest/_view/manufacturers/count

and it returns

{"rows":[{"key":null,"value":7740}]}

Mime
View raw message