Sokil\Mongo\CollectionTest::testGetDistinct_ExpressionCallable PHP Method

testGetDistinct_ExpressionCallable() public method

    public function testGetDistinct_ExpressionCallable()
    {
        $this->collection->createDocument(array('k' => array('f' => 'F1', 'kk' => 'A')))->save();
        $this->collection->createDocument(array('k' => array('f' => 'F1', 'kk' => 'A')))->save();
        $this->collection->createDocument(array('k' => array('f' => 'F1', 'kk' => 'B')))->save();
        $this->collection->createDocument(array('k' => array('f' => 'F2', 'kk' => 'C')))->save();
        // get distinkt
        $distinctValues = $this->collection->getDistinct('k.kk', function ($expression) {
            $expression->where('k.f', 'F1');
        });
        $this->assertEquals(array('A', 'B'), $distinctValues);
    }
CollectionTest