-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query Integration
The following StackOverflow question and answer raises the issue and provides a solution for this feature.
Resample Time Series Data using Javascript and Mongodb
In addition of creating a bucket with predefined boundaries ($bucket), or one with autogenerated boundaries ($bucketAuto), it would be helpful to have a bucket stage which is given an upper and lower boundary, and the buckets are generated automatically at fixed, predefined intervals, for example
{{{}}
$bucketInterval: {
groupBy: '$timestamp',
}}{{lower: ISODate("2014-10-23T00:00:00.000+02:00"),
}}{{upper: ISODate("2014-10-24T00:00:00.000+02:00"),
}}{{interval: 5*60*1000,
}}{{output: {
total: {$sum: 1},
incoming: {$sum: "$i"},
outgoing: {$sum: "$o"},
}}{
{{ }}}
}