Question

I created a view.

map

function(doc) {
  emit(doc.country, 1);
}

reduce(Raw view)

function(key, values) {
  return sum(values);
}

result

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

I want to get these results.(example)

{"rows":[
{"key":US,"value":2135}
{"key":CN,"value":556}
{"key":EN,"value":5414}
]}

like this....

I do not know what to do.

Was it helpful?

Solution

Use group_level=1 when you query.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top