public function explainAggregate($pipeline) { if (version_compare($this->getDatabase()->getClient()->getDbVersion(), '2.6.0', '<')) { throw new Exception('Explain of aggregation implemented only from 2.6.0'); } if ($pipeline instanceof Pipeline) { $pipeline = $pipeline->toArray(); } elseif (!is_array($pipeline)) { throw new Exception('Wrong pipeline specified'); } // aggregate return $this->_database->executeCommand(array('aggregate' => $this->getName(), 'pipeline' => $pipeline, 'explain' => true)); }