Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-37136

$bucketInterval for grouping data in intervaled buckets (eg. time series)

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

       

       

            Assignee:
            backlog-query-integration [DO NOT USE] Backlog - Query Integration
            Reporter:
            danielfaust Daniel Faust
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: