Group and count using aggregation framework
问题 I'm trying to group and count the following structure: [{ "_id" : ObjectId("5479c4793815a1f417f537a0"), "status" : "canceled", "date" : ISODate("2014-11-29T00:00:00.000Z"), "offset" : 30, "devices" : [ { "name" : "Mouse", "cost" : 150, }, { "name" : "Keyboard", "cost" : 200, } ], }, { "_id" : ObjectId("5479c4793815a1f417d557a0"), "status" : "done", "date" : ISODate("2014-10-20T00:00:00.000Z"), "offset" : 30, "devices" : [ { "name" : "LCD", "cost" : 150, }, { "name" : "Keyboard", "cost" : 200,