public function aggregate($collectionName, $pipelines, $options = [])
{
$this->document = $this->db->getQueryBuilder()->aggregate($collectionName, $pipelines, $options);
$cursor = $this->execute();
$result = current($cursor->toArray());
return $result['result'];
}