Aggregation by Date

The aggregation can be improved with the pipeline

var q3 = [
    { $unwind: '$resp.'+starCode },
    { $project: { stars: '$resp.'+starCode } }, 
    { $group:  {
        _id: { $dateToString: { format: '%H:%M %Y-%m-%d', date: '$date' } },
        total: { $sum: '$stars' },
        count: { $sum: 1 }
      }
    }            
]

replaced with the following, and eliminating the $project stage:

var q3 = [
    { $unwind: '$resp.'+starCode },
    { $group:  {
        _id: { $dateToString: { format: '%H:%M %Y-%m-%d', date: '$date' } },
        total: { $sum: '$resp.'+starCode },
        count: { $sum: 1 }
      }
    }    
]