public function testExplainAggregate() { $this->collection->createDocument(array('param' => 1))->save(); $this->collection->createDocument(array('param' => 2))->save(); $this->collection->createDocument(array('param' => 3))->save(); $this->collection->createDocument(array('param' => 4))->save(); $pipeline = $this->collection->createAggregator()->match(array('param' => array('$gte' => 2)))->group(array('_id' => 0, 'sum' => array('$sum' => '$param'))); try { $explain = $this->collection->explainAggregate($pipeline); $this->assertArrayHasKey('stages', $explain); } catch (\Exception $e) { $this->assertEquals('Explain of aggregation implemented only from 2.6.0', $e->getMessage()); } }