code: def _flush_aggregated_objects(self):
          
          if len(self.aggregated_objects) == 0:
              # nothing to do
              return 0
  
          number_of_aggregated_objects = len(self.aggregated_objects)
          self.logger.info('Aggregated {0} documents. Performing flush.'.format(number_of_aggregated_objects))
  
          for key in self.aggregated_objects:
              document = self.aggregated_objects[key]
              mongo_pk = self._mongo_sink_key(*key)
              self.ds.update(self.sink, mongo_pk, document)
  
          self.logger.info('Flush successful.')
  
          del self.aggregated_objects
          self.aggregated_objects = dict()
          gc.collect()
          return number_of_aggregated_objects
docs: method inserts aggregated objects into MongoDB
              :return number_of_aggregated_objects