1.时间戳转换成String类型,在转成Date,去掉时分秒mongodb
Aggregation.project().andExpression("dateToString('%Y-%m-%d', add([0],'$createTime',28800000))",new Date(0)).as("drinkTime")
2.时间戳去掉时分秒ide
Aggregation.project().andExpression("floor(divide($createTime,86400000))").as("groupCreateTime")
Aggregation.project("_id") .andExpression("year(drinkTime)").as("year") .andExpression("month(drinkTime)").as("month") .andExpression("dayOfMonth(drinkTime)").as("day")