I am new to the whole concept of map reduction and I am trying to perform a simple map reduction function.
I am currently working with a Couchbase server as a NoSQL database.
I want to get a list of all my types:
key: 1, value: null key: 2, value: null key: 3, value: null
Here are my docs:
{ "type": "1", "value": "1" } { "type": "2", "value": "2" } { "type": "3", "value": "3" } { "type": "1", "value": "4" }
What I'm trying to do is: Write a display function:
function (doc, meta) { emit(doc.type, 0); }
Using the built-in reduction function:
_count
But I do not get the expected result.
How can I get all types?
UPDATE
Note that types are different documents, and I know that pruning works on a document and is not performed outside of it.
source share