The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > lite > collectionGroup

collectionGroup() function

Creates and returns a new Query instance that includes all documents in the database that are contained in a collection or subcollection with the given collectionId.

Signature:

export declare function collectionGroup(firestore: FirebaseFirestore, collectionId: string): Query<DocumentData>;

Parameters

Parameter Type Description
firestore FirebaseFirestore A reference to the root Firestore instance.
collectionId string Identifies the collections to query over. Every collection or subcollection with this ID as the last segment of its path will be included. Cannot contain a slash.

Returns:

Query<DocumentData>

The created Query.