Skip to content

Instantly share code, notes, and snippets.

@cessor
Last active January 4, 2016 21:09
Show Gist options
  • Save cessor/8679395 to your computer and use it in GitHub Desktop.
Save cessor/8679395 to your computer and use it in GitHub Desktop.
Kalauer...
var pipeline = [
{$match: { 'scored': true }},
{$unwind:'$trials'},
{$project: {
'trials.snippet': 1,
'trials.condition': 1}
},
{$group: {
_id: {
'condition': '$trials.condition',
'snippet': '$trials.snippet'},
count: {$sum: 1 }
}
}];
db.behavior.aggregate(pipeline);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment