Je moet $match gebruiken :
db['!all'].aggregate([
{$match:
{'GENDER': 'F',
'DOB':
{ $gte: 19400801,
$lte: 20131231 } } },
{$group:
{_id: "$GENDER",
totalscore:{ $sum: "$BRAINSCORE"}}}
])
Uitgangen:
{ "_id" : "F", "totalscore" : 109 }