mongodb runcommand group使用方法
db.runCommand(
{
group:
{
ns:"testc",
key:{name:null},
initial:{num:0},
$reduce:function(doc,prev)
{
prev.num++;
}
}
}
)
{
"retval":[
{
"name":"sulin",
"num":1
}
,
{
"name":"lihui",
"num":1
}
],
"count":2,
"keys":2,
"ok":1
}
)
}