I am trying to write an aggregation to identify accounts that use multiple payment sources. Typical data would be.
{ account:\"abc\", vendor:\"amazon\", }
I do not see why somebody would have to use $group twice
db.t2.aggregate([ { $group: {"_id":"$account" , "number":{$sum:1}} } ])
This will work perfectly fine.