Sokil\Mongo\CursorTest::testReturnSpecifiedFields PHP Method

testReturnSpecifiedFields() public method

    public function testReturnSpecifiedFields()
    {
        // create new document
        $document = $this->collection->createDocument(array('a' => 'a1', 'b' => 'b1', 'c' => 'c1', 'd' => 'd1'));
        $document->save();
        $documentId = $document->getId();
        // fild some fields of document
        $document = $this->collection->find()->fields(array('a', 'c'))->field('b')->findOne();
        $this->assertEquals(array('a' => 'a1', 'b' => 'b1', 'c' => 'c1', '_id' => $documentId), $document->toArray());
    }