db.building_hour.aggregate({
"$match": {
"_id.time": {
"$gte": new Date("2014-11-05 00:00:00"),
"$lt": new Date("2014-11-06 00:00:00")
}
}
},
{
"$group": {
"_id": {
"$hour": "$_id.time"
},
"serials": {
"$push": {
"buildingid":"$_id.buildingid",
"value": "$value"
}
}
}
},
最后结果