Sokil\Mongo\CursorTest::testExplain PHP Method

testExplain() public method

public testExplain ( )
    public function testExplain()
    {
        $this->collection->createDocument(array('param1' => 1, 'param2' => 1))->save();
        $this->collection->createDocument(array('param1' => 1, 'param2' => 2))->save();
        $explain = $this->collection->find()->where('param1', 2)->explain();
        $currentVersion = $this->collection->getDatabase()->getClient()->getDbVersion();
        if (version_compare($currentVersion, '3', '<')) {
            $this->assertArrayHasKey('cursor', $explain);
        } else {
            $this->assertArrayHasKey('queryPlanner', $explain);
        }
    }