src/Mongo/MongoService.php
public function aggregate($collection, array $pipeline, $options = [])
    {
        $data = $this->dbConnection->selectCollection($collection)->aggregate($pipeline);
        if ($data['ok'] != 1) {
            throw new Exception("Tool Aggregation Error: ".$data['errmsg'], $data['code']);
        }

        return $data['result'];
    }
public function aggregate($collection, array $pipeline, $options = [])
    {
        $data = $this->dbConnection->selectCollection($collection)->aggregate($pipeline);
        if ($data['ok'] != 1) {
            throw new Exception("Tool Aggregation Error: ".$data['errmsg'], $data['code']);
        }

        return $data['result'];
    }
public function aggregate ( $ collection , array $ pipeline , $ options = [ ] ) { $ data = $ this -> dbConnection -> selectCollection ( $ collection ) -> aggregate ( $ pipeline ) ; if ( $ data [ 'ok' ] != 1 ) { throw new Exception ( "Tool Aggregation Error: " . $ data [ 'errmsg' ] , $ data [ 'code' ] ) ; } return $ data [ 'result' ] ; }
Run Aggregation through the Aggregation Pipeline

@param string $collection
@param array $pipeline
@param array $options
@return mixed
@throws Exception
Run Aggregation through the Aggregation Pipeline