public function testAggregate_AllowDiskUseOption()
{
$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')))->allowDiskUse();
try {
$result = $this->collection->aggregate($pipeline);
$this->assertArrayHasKey('sum', $result['0']);
$this->assertEquals(9, $result['0']['sum']);
} catch (\Exception $e) {
$this->assertEquals('Option allowDiskUse of aggregation implemented only from 2.6.0', $e->getMessage());
}
}