markdown PostPogo聚合通过timebuckets -
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown PostPogo聚合通过timebuckets -相关的知识,希望对你有一定的参考价值。
To aggregate timeseries based off of post types, need two values -
1. the timebucket wrapper
2. the type of time series you want (days, minutes, weeks, etc...)
Below gives me aggregation for Feb. 2015 by type by minute -
db.post.aggregate(
{$match: {timebucket: "2015-1-m"}},
{$unwind: "$timebucket"},
{$match: {timebucket:{$regex : ".*-min$"}}},
{$project: {tb_type: {$concat: ["$timebucket", "/", "$type"]}}},
{$group: {_id: "$tb_type", count: {"$sum": 1}}} );
Results -
{ "_id" : "2015-1-11-21-1-min/vine", "count" : 1 }
{ "_id" : "2015-1-11-12-1-min/vine", "count" : 1 }
{ "_id" : "2015-1-7-0-1-min/vine", "count" : 1 }
{ "_id" : "2015-1-4-23-1-min/vine", "count" : 1 }
{ "_id" : "2015-1-1-16-1-min/vine", "count" : 1 }
{ "_id" : "2015-1-1-14-1-min/vine", "count" : 1 }
Example Timebuckets -
[
'2014-7-1-10-7-min',
'2014-7-1-10-h',
'2014-7-1-d',
'2014-7-5-dowm',
'2014-5-dowy',
'2014-7-m',
'2014-y',
'2014-31-w',
'31-wa',
'5-dowa'
]
以上是关于markdown PostPogo聚合通过timebuckets -的主要内容,如果未能解决你的问题,请参考以下文章
markdown PostPogo HighCharts按小时/分钟显示
markdown 聚合物Codificacion
markdown MongoDB的聚合
markdown 聚合物的角度样式指南
markdown 聚合物
markdown 聚合物片段