code: public function findByHistoryAndSiteId($id, $siteId, array $eventTypes = null, $published = null, $limit = null, array $sort = null)
      {
          $qa = $this->createAggregationQuery();
          $filter = array(
              'nodeType' => NodeInterface::TYPE_DEFAULT,
              'histories.user.$id' => new \MongoId($id),
              'siteId' => $siteId,
              'deleted' => false
          );
          if (null !== $eventTypes) {
              $filter['histories.eventType'] = array('$in' => $eventTypes);
          }
          if (null !== $published) {
              $filter['status.publishedState'] = $published;
          }
          $qa->match($filter);
  
          if (null !== $sort) {
              $qa->sort($sort);
          }
  
          if (null !== $limit) {
              $qa->limit($limit);
          }
  
          return $this->hydrateAggregateQuery($qa);
      }
docs: @param string       $id
  @param string       $siteId
  @param array|null   $eventTypes
  @param boolean|null $published
  @param int|null     $limit
  @param array|null   $sort
  
  @return array