Jag kunde hitta en lösning med $cond i min $group-operation.
db.project.aggregate(
{ $match : { brandId : 4 } },
{ $project : {
_id : 0,
brandId : 1,
count : 1,
day : 1}
},
{ $group : {
_id : "$brand",
TotalCount : { $sum : "$count" },
countInTimeRange : {$sum: { $cond: [ { $and: [{$gte: [ "$day", new Date(2014, 0, 6) ] }, {$lte: [ "$day", new Date(2014, 0, 8) ] }] }, "$count", 0 ] }}
}}
)