MapReduce for counting parameter values
Posted
by
cnkt
on Stack Overflow
See other posts from Stack Overflow
or by cnkt
Published on 2010-12-27T02:56:24Z
Indexed on
2010/12/27
6:54 UTC
Read the original article
Hit count: 321
I have document like this:
{
"_id": ObjectId("4d17c7963ffcf60c1100002f"),
"title": "Text",
"params": {
"brand": "BMW",
"model": "i3"
}
}
{
"_id": ObjectId("4d17c7963ffcf60c1100002f"),
"title": "Text",
"params": {
"brand": "BMW",
"model": "i5"
}
}
What i need is the count of every params values. like:
brand
---------
BMW (2)
model
---------
i3 (1)
i5 (1)
I think i have to write map/reduce functions. How can i do this? Thanks.
© Stack Overflow or respective owner