这是我的文档架构:
{
"_id" : ObjectId("5203c8b91afdd7160c6ecfd3"),
"answer_calls" : "",
"start" : "10:00",
"end" : "10:30",
"VDN_name" : "SP_SYNDICATED_7",
"total_calls" : "1",
"date" : "01/07/2013",
"abandoned_calls" : "",
"voicemail_calls" : ""
}
我通过聚合框架尝试这样做:
> dir.aggregate(
[
{ $group:
{_id: {fecha:"$date", hora: "$start"},
llamadas :{ $sum:"$total_calls"},
abandoned: {$sum:"$abandoned_calls"},
mail: {$sum:"$voicemail_calls"}
}
},
{ $sort: {fecha:1,hora:1} }
] )
这是一个结果示例:
{
"_id" : {
"fecha" : "16/07/2013",
"hora" : "18:30"
},
"llamadas" : 0,
"abandoned" : 0,
"mail" : 0
}
问题是它没有$sum也没有$sort
有人知道为什么吗?