code: public function findByHistoryAndSiteId(
          $id,
          $siteId,
          array $eventTypes = null,
          $published = null,
          $limit = null,
          array $sort = null,
          array $contentTypes = array()
      ) {
          $qa = $this->createAggregationQuery();
          $filter = array(
              'histories.user.$id' => new \MongoId($id),
              'deleted' => false
          );
          $qa->match($this->generateSiteIdAndNotLinkedFilter($siteId));
          if (null !== $eventTypes) {
              $filter['histories.eventType'] = array('$in' => $eventTypes);
          }
          if (null !== $published) {
              $filter['status.publishedState'] = $published;
          }
          if (!empty($contentTypes)) {
              $filter['contentType'] = array('$in' => $contentTypes);
          }
  
          $qa->match($filter);
  
          if (null !== $limit) {
              $qa->limit($limit);
          }
  
          if (null !== $sort) {
              $qa->sort($sort);
          }
  
          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
  @param array        $contentTypes
  
  @return array