Du skal bruge $match :
db['!all'].aggregate([
{$match:
{'GENDER': 'F',
'DOB':
{ $gte: 19400801,
$lte: 20131231 } } },
{$group:
{_id: "$GENDER",
totalscore:{ $sum: "$BRAINSCORE"}}}
])
Udgange:
{ "_id" : "F", "totalscore" : 109 }