Class CollectionGroup (4.14.2)

A CollectionGroup refers to all documents that are contained in a collection or subcollection with a specific collection ID.

CollectionGroup

Inheritance

Query<T> > CollectionGroup

Package

@google-cloud/firestore!

Constructors

(constructor)(firestore, collectionId, converter)

constructor(firestore: Firestore, collectionId: string, converter: firestore.FirestoreDataConverter<T> | undefined);

Constructs a new instance of the CollectionGroup class

Parameters
NameDescription
firestore Firestore
collectionId string
converter FirebaseFirestore.FirestoreDataConverter<T> | undefined

Methods

getPartitions(desiredPartitionCount)

getPartitions(desiredPartitionCount: number): AsyncIterable<QueryPartition<T>>;

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

Parameter
NameDescription
desiredPartitionCount number

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

Returns
TypeDescription
AsyncIterable<QueryPartition<T>>

withConverter(converter)

withConverter(converter: null): CollectionGroup<firestore.DocumentData>;

Applies a custom data converter to this CollectionGroup, allowing you to use your own custom model objects with Firestore. When you call get() on the returned CollectionGroup, the provided converter will convert between Firestore data and your custom type U.

Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.

Passing in null as the converter parameter removes the current converter.

Parameter
NameDescription
converter null

Converts objects to and from Firestore. Passing in null removes the current converter. {CollectionGroup} A CollectionGroup<U> that uses the provided converter.

Returns
TypeDescription
CollectionGroup<FirebaseFirestore.DocumentData>

withConverter(converter)

withConverter<U>(converter: firestore.FirestoreDataConverter<U>): CollectionGroup<U>;
Parameter
NameDescription
converter FirebaseFirestore.FirestoreDataConverter<U>
Returns
TypeDescription
CollectionGroup<U>
Type Parameter
NameDescription
U