I have an array of objects like this..
[
{
_id: 123
},
{
_id: 123
},
{
_id: 321
}
]
I want to group similar items by _id and also count how many items of each unique _id there are...
[
{
_id: 123
qty: 2
},
{
_id: 321
qty: 1
}
]
Whats the best way to do this using javascript?