Group level on Node.js



I trying to make work the group_level in node.js but I always get this error:

{ [Error: REST error query_parse_error] code: 4104, reason: 'Multi-key fetchs for reduce view must include `group=true`' }

And as you can see in the call code (above) I’m using the flag group=true.

viewQuery.query( {keys:[ [appID, "1"], [appID, "2"], [appID, "3"] ], group:true, group_level:1, reduce:true}, function(err, results)

Any idea why this is happening? With out the group_level works fine but just group by general level.

Thank you!


Do you mind showing us the View code and some JSON document it will help to debug.

Can you execute the Query from the browser using the REST URL, if yes can you share with us the parameters that are working.




Here’s my view:

function (doc, meta)
if(doc.jsonType == “device” && == 1 && doc.disabled == 0)
emit([doc.app_id, doc.platform_id] , doc.last_open[0]);

Also I have discovered that If I call the view using a range of keys the group level works, in this way:

viewQuery.query( {startkey:[1, 1], endkey:[1, 3], group_level:1, reduce:true}, function(err, results)

So I have needed remove the group tag and use just the group_level, but this doesn’t work when the key is not a range and is an array of keys…

If I use the REST API I have the same error on the website:


{“error”:“query_parse_error”,“reason”:"Multi-key fetchs for reduce view must include group=true"}

Also please document that in the website…