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分組
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.