db.getCollection("LogLogin").aggregate([
{
$group :{
_id: {
createtime :{$dateToString: { format : "%Y-%m-%d", date: "$createtime"}},
username: "$username"
},
count: {$sum: 1}
}
}
,
{
$project : {
_id : 0,
createtime :"$_id.createtime",
username : "$_id.username",
count: 1
}
}
])
mongodb分组
最新推荐文章于 2024-05-01 09:08:17 发布