Class CollectionGroup (2.22.0)

CollectionGroup(
    parent,
    projection=None,
    field_filters=(),
    orders=(),
    limit=None,
    limit_to_last=False,
    offset=None,
    start_at=None,
    end_at=None,
    all_descendants=True,
    recursive=False,
)

Represents a Collection Group in the Firestore API.

This is a specialization of .Query that includes all documents in the database that are contained in a collection or subcollection of the given parent.

Parameter

Name Description
parent CollectionReference

The collection that this query applies to.

Methods

get_partitions

get_partitions(
    partition_count,
    retry: retries.Retry | object | None = _MethodDefault._DEFAULT_VALUE,
    timeout: float | None = None,
    *,
    read_time: Optional[datetime.datetime] = None
) -> Generator[QueryPartition, None, None]

Partition a query for parallelization.

Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used as starting/end points for the query results.

Parameters
Name Description
partition_count int

The desired maximum number of partition points. The number must be strictly positive. The actual number of partitions returned may be fewer.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried. Defaults to a system-specified policy.

timeout float

The timeout for this request. Defaults to a system-specified value.

read_time Optional[datetime.datetime]

If set, reads documents as they were at the given time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days. For the most accurate results, use UTC timezone.