Skip to content

Instantly share code, notes, and snippets.

@charlesBochet
Created July 2, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesBochet/d2b8cccc7d95b27277fa1ea364529a35 to your computer and use it in GitHub Desktop.
Save charlesBochet/d2b8cccc7d95b27277fa1ea364529a35 to your computer and use it in GitHub Desktop.
{
'$group': {
'_id': {
'quarterStart': '$_id.quarterStart',
'clientCode': '$_id.clientCode'
},
'recipients': {
'$push': {
'recipient': '$_id.recipient',
'count': '$count'
},
},
'totalCount': {
'$sum': '$count'
},
'recipientsCount': {
'$sum': 1
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment