javascript - Multiple groups with mongodb aggregate -
i'm trying use mongodb aggregate on data: "_id": objectid("598dbd301ab6476e5b15e05e"), "updated_at": isodate("2017-08-11t14:20:32.865z"), "created_at": isodate("2017-08-11t14:20:32.865z"), "action": objectid("59760749a398cb323cf1c051"), "subaction": objectid("5980c3807a8cb300110d87d3"), "person": objectid("598dbd2f1ab6476e5b15e05b"), "session": objectid("598dbd2f1ab6476e5b15e05c"), "dateaccomplish": isodate("2017-08-11t14:20:32z"), "createdby": objectid("595f8426645bf5f47366fb29"), "updatedby": objectid("595f8426645bf5f47366fb29"), what i'm trying need retrieve 2 groups. has grouped actions , subactions . the output data expected looks this: movactions: [ { _id: $created_at, count: ?, data:[ { _id: "$action", ...