I am trying to write an aggregation to identify accounts that use multiple payment sources. Typical data would be.
{ account:\"abc\", vendor:\"amazon\", }
db.UserModule.aggregate( { $group : { _id : { "companyauthemail" : "$companyauthemail", "email" : "$email" }, number : { $sum : 1 } } }, { $group : { _id : "$_id.companyauthemail", number : { $sum : 1 } } } );