Sokil\Mongo\Collection::find PHP Méthode

find() public méthode

Create document query builder
public find ( $callable = null ) : Cursor | Expression
$callable callable|null Function to configure query builder&
Résultat Cursor | Expression
    public function find($callable = null)
    {
        /** @var \Sokil\Mongo\Cursor $cursor */
        $cursor = new Cursor($this, array('expressionClass' => $this->definition->getExpressionClass(), 'batchSize' => $this->definition->getOption('batchSize'), 'clientTimeout' => $this->definition->getOption('cursorClientTimeout'), 'serverTimeout' => $this->definition->getOption('cursorServerTimeout')));
        if (is_callable($callable)) {
            $callable($cursor->getExpression());
        }
        return $cursor;
    }

Usage Example

 public function testFlush()
 {
     $document = $this->collection->createDocument(array('param' => 'value'));
     // add document
     $this->persistence->persist($document)->flush();
     $this->assertEquals('value', $this->collection->find()->findOne()->param);
 }
All Usage Examples Of Sokil\Mongo\Collection::find