【发布时间】:2011-08-07 08:25:15
【问题描述】:
我从未尝试过 map/reduce。
我如何获得每种动物中最老的?
我的数据是这样的:
[
{
"cateory": "animal",
"type": "cat",
"age": 4,
"id": "a"
},
{
"cateory": "animal",
"type": "bird",
"age": 3,
"id": "b"
},
{
"cateory": "animal",
"type": "cat",
"age": 7
"id": "c"
},
{
"cateory": "animal",
"type": "bird",
"age": 4,
"id": "d"
},
{
"cateory": "animal",
"type": "cat",
"age": 8,
"id": "e"
},
{
"cateory": "company",
"type": "Internet",
"age": 5,
"id": "Facebook"
}
]
我正在使用 node-mongodb-native。谢谢!
【问题讨论】:
-
如果你使用mongoose和mongodb,这里是如何实现map/reduce gist.github.com/1123688
标签: javascript mongodb node.js mapreduce