Firestore/src/Query.php
public function documents(array $options = [])
    {
        $maxRetries = $this->pluck('maxRetries', $options, false);
        $maxRetries = $maxRetries === null
            ? FirestoreClient::MAX_RETRIES
            : $maxRetries;

        $rows = (new ExponentialBackoff($maxRetries))->execute(function () use ($options) {
            $query = $this->finalQueryPrepare($this->query);
            $generator = $this->connection->runQuery($this->arrayFilterRemoveNull([
                'parent' => $this->parent,
                'structuredQuery' => $query,
                'retries' => 0
            ]) + $options);

            // cache collection references
            $collections = [];

            $out = [];
            while ($generator->valid()) {
                $result = $generator->current();

                if (isset($result['document']) && $result['document']) {
                    $collectionName = $this->parentPath($result['document']['name']);
                    if (!isset($collections[$collectionName])) {
                        $collections[$collectionName] = new CollectionReference(
                            $this->connection,
                            $this->valueMapper,
                            $collectionName
                        );
                    }

                    $ref = new DocumentReference(
                        $this->connection,
                        $this->valueMapper,
                        $collections[$collectionName],
                        $result['document']['name']
                    );

                    $document = $result['document'];
                    $document['readTime'] = $result['readTime'];

                    $out[] = $this->createSnapshotWithData($this->valueMapper, $ref, $document);
                }

                $generator->next();
            }

            return $out;
        });

        return new QuerySnapshot($this, $rows);
    }
public function documents(array $options = [])
    {
        $maxRetries = $this->pluck('maxRetries', $options, false);
        $maxRetries = $maxRetries === null
            ? FirestoreClient::MAX_RETRIES
            : $maxRetries;

        $rows = (new ExponentialBackoff($maxRetries))->execute(function () use ($options) {
            $query = $this->finalQueryPrepare($this->query);
            $generator = $this->connection->runQuery($this->arrayFilterRemoveNull([
                'parent' => $this->parent,
                'structuredQuery' => $query,
                'retries' => 0
            ]) + $options);

            // cache collection references
            $collections = [];

            $out = [];
            while ($generator->valid()) {
                $result = $generator->current();

                if (isset($result['document']) && $result['document']) {
                    $collectionName = $this->parentPath($result['document']['name']);
                    if (!isset($collections[$collectionName])) {
                        $collections[$collectionName] = new CollectionReference(
                            $this->connection,
                            $this->valueMapper,
                            $collectionName
                        );
                    }

                    $ref = new DocumentReference(
                        $this->connection,
                        $this->valueMapper,
                        $collections[$collectionName],
                        $result['document']['name']
                    );

                    $document = $result['document'];
                    $document['readTime'] = $result['readTime'];

                    $out[] = $this->createSnapshotWithData($this->valueMapper, $ref, $document);
                }

                $generator->next();
            }

            return $out;
        });

        return new QuerySnapshot($this, $rows);
    }
public function documents ( array $ options = [ ] ) { $ maxRetries = $ this -> pluck ( 'maxRetries' , $ options , false ) ; $ maxRetries = $ maxRetries === null ? FirestoreClient :: MAX_RETRIES : $ maxRetries ; $ rows = ( new ExponentialBackoff ( $ maxRetries ) ) -> execute ( function ( ) use ( $ options ) { $ query = $ this -> finalQueryPrepare ( $ this -> query ) ; $ generator = $ this -> connection -> runQuery ( $ this -> arrayFilterRemoveNull ( [ 'parent' => $ this -> parent , 'structuredQuery' => $ query , 'retries' => 0 ] ) + $ options ) ; // cache collection references $ collections = [ ] ; $ out = [ ] ; while ( $ generator -> valid ( ) ) { $ result = $ generator -> current ( ) ; if ( isset ( $ result [ 'document' ] ) && $ result [ 'document' ] ) { $ collectionName = $ this -> parentPath ( $ result [ 'document' ] [ 'name' ] ) ; if ( ! isset ( $ collections [ $ collectionName ] ) ) { $ collections [ $ collectionName ] = new CollectionReference ( $ this -> connection , $ this -> valueMapper , $ collectionName ) ; } $ ref = new DocumentReference ( $ this -> connection , $ this -> valueMapper , $ collections [ $ collectionName ] , $ result [ 'document' ] [ 'name' ] ) ; $ document = $ result [ 'document' ] ; $ document [ 'readTime' ] = $ result [ 'readTime' ] ; $ out [ ] = $ this -> createSnapshotWithData ( $ this -> valueMapper , $ ref , $ document ) ; } $ generator -> next ( ) ; } return $ out ; } ) ; return new QuerySnapshot ( $ this , $ rows ) ; }
Get all documents matching the provided query filters.

Example:
```
$result = $query->documents();
```

@codingStandardsIgnoreStart
@see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.RunQuery RunQuery
@codingStandardsIgnoreEnd
@param array $options {
Configuration options.

@type int $maxRetries The maximum number of times to retry a query.
**Defaults to** `5`.
}
@return QuerySnapshot<DocumentSnapshot>
Get all documents matching the provided query filters .