Cloud Firestore V1 Client - Class FirestoreClient (1.44.1)

Reference documentation and code samples for the Cloud Firestore V1 Client class FirestoreClient.

Service Description: The Cloud Firestore service.

Namespace

Google \ Cloud \ Firestore \ V1

Methods

partitionQuery

See also:

  • \Google\Cloud\Firestore\V1\FirestoreClient::partitionQueryPaginated
Parameter
Name Description
optionalArgs array
Returns
Type Description
Google\Cloud\Firestore\V1\PartitionQueryResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Firestore\V1\Client\FirestoreClient;
use Google\Cloud\Firestore\V1\Cursor;
use Google\Cloud\Firestore\V1\PartitionQueryRequest;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function partition_query_sample(): void
{
    // Create a client.
    $firestoreClient = new FirestoreClient();

    // Prepare the request message.
    $request = new PartitionQueryRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $firestoreClient->partitionQuery($request);

        /** @var Cursor $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

static::anyPathName

Formats a string containing the fully-qualified path to represent a any_path resource.

Parameters
Name Description
project string
database string
document string
anyPath string
Returns
Type Description
string The formatted any_path resource.

static::databaseRootName

Formats a string containing the fully-qualified path to represent a database_root resource.

Parameters
Name Description
project string
database string
Returns
Type Description
string The formatted database_root resource.

static::documentPathName

Formats a string containing the fully-qualified path to represent a document_path resource.

Parameters
Name Description
project string
database string
documentPath string
Returns
Type Description
string The formatted document_path resource.

static::documentRootName

Formats a string containing the fully-qualified path to represent a document_root resource.

Parameters
Name Description
project string
database string
Returns
Type Description
string The formatted document_root resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • anyPath: projects/{project}/databases/{database}/documents/{document}/{any_path=**}
  • databaseRoot: projects/{project}/databases/{database}
  • documentPath: projects/{project}/databases/{database}/documents/{document_path=**}
  • documentRoot: projects/{project}/databases/{database}/documents.

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name Description
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.