How to group and sort object array?
问题 I've got an object array which I have to group and sort: [ { id: 123, group: 'abc', metadata: { name: 'tom' }, date: ISODate("2019-07-08T20:33:40.475Z") }, { id: 456, group: 'def', metadata: { name: 'bob' }, date: ISODate("2019-07-08T20:33:40.475Z") }, { id: 789, group: 'def', metadata: { name: 'bob' }, date: ISODate("2019-07-10T20:33:40.475Z") }, { id: 234, group: 'ghi', metadata: { name: 'frank' }, date: ISODate("2019-07-10T20:33:40.475Z") }, { id: 567, group: 'abc', metadata: { name: 'tom'