code: function getTotals(feedId, prep) {
  
      var range = prep.range;
      var unit = prep.unit;
      var year = prep.year;
  
      var result = {
        counts: []
      };
  
      return Model.findOne({
        fields: {
          total: true
        },
        where: {
          feedId: feedId,
          type: prep.result.period,
          key: prep.result.value
        }
      })
        .then(function(count) {
  
          if (!count) {
            return;
          }
  
          if (!count.total) {
            return;
          }
  
          result.total = count.total;
  
          return Model.find({
            fields: {
              key: true,
              total: true
            },
            where: {
              feedId: feedId,
              type: unit,
              year: year,
              key: {
                between: [range[0], range[range.length - 1]]
              }
            }
          });
        })
        .then(function(counts) {
  
          if (!counts) {
            return;
          }
  
          counts = _.keyBy(counts, 'key');
  
          for (var key of range) {
            var count = counts[key];
            if (count) {
              count.total = count.total || 0;
              result.counts.push(count);
              continue;
            }
            result.counts.push({
              key: key,
              total: 0,
              not_found: true
            });
          }
  
        })
        .then(function() {
          return result;
        });
    }
docs: ///////////////////////////////////////////////////////////////