Alcaeus\MongoDbAdapter\Tests\Mongo\MongoCollectionTest::testAggregateCursor PHP Method

testAggregateCursor() public method

public testAggregateCursor ( )
    public function testAggregateCursor()
    {
        $collection = $this->getCollection();
        $this->prepareData();
        $pipeline = [['$group' => ['_id' => '$foo', 'count' => ['$sum' => 1]]], ['$sort' => ['_id' => 1]]];
        $cursor = $collection->aggregateCursor($pipeline);
        $this->assertInstanceOf('MongoCommandCursor', $cursor);
        $this->assertEquals([['_id' => 'bar', 'count' => 2], ['_id' => 'foo', 'count' => 1]], iterator_to_array($cursor));
    }
MongoCollectionTest