首页新闻找找看学习计划

下面的mongodb查询语句用mongoTemplate聚合查询怎么实现?

0
悬赏园豆:10 [已关闭问题] 关闭于 2015-01-22 17:48

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"
                            }                 
                   }                     
         }
},

最后结果

bichen的主页 bichen | 初学一级 | 园豆:190
提问于:2014-12-15 21:29
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册