code: def process_item(self, item):
          
          group, value = item['group'], item['value']
          if group in self._groups:
              cur_val = self._groups[group]
              self._groups[group] = max(cur_val, value)
          else:
              # New group. Could fetch old max. from target collection,
              # but for the sake of illustration recalculate it from
              # the source collection.
              self._src.tracking = False  # examine entire collection
              new_max = value
              for rec in self._src.query(criteria={'group': group},
                                         properties=['value']):
                  new_max = max(new_max, rec['value'])
              self._src.tracking = True  # back to incremental mode
              # calculate new max
              self._groups[group] = new_max
docs: Calculate new maximum value for each group,
          for "new" items only.