public function testAggregate_ResultAsCursor() { $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'))); $result = $this->collection->aggregate($pipeline, array(), true); $this->assertInstanceOf('\\MongoCommandCursor', $result); }
public function aggregate() { return $this->collection->aggregate($this); }
/** * @expectedException \Sokil\Mongo\Exception * @expectedExceptionMessage Wrong pipeline specified */ public function testAggregate_WrongArgument() { $this->collection->aggregate('hello'); }
public function aggregateCursor(array $options = array()) { return $this->collection->aggregate($this, $options, true); }