mongoDB query for count : I have a mongoDB question on count.

I want to count the number of fields with the name 'appId' by month day year.

I know in SQL you could do this by 

    "SELECT COUNT(appID)
    FROM stats
    GROUP BY YEAR(record_date), MONTH(record_date)"

How does that translate to mongodb?

    { $group : {
            _id: {      
                month : { $month : "$date" },        
                day : { $dayOfMonth : "$date" },
    			year : { $year : "$date" },
            },
            count: { $sum: * } *all the fields?
        }
    }

Also how would I could the number of 'appId' whos 'criticalThreshold' is greater than 'critical'


