Home > @firebase/firestore > lite > collection
collection() function
Gets a CollectionReference
instance that refers to a subcollection of reference
at the the specified relative path.
Signature:
export declare function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference<DocumentData>;
Parameters
Parameter | Type | Description |
---|---|---|
reference | DocumentReference | A reference to a Firestore document. |
path | string | A slash-separated path to a collection. |
pathSegments | string[] | Additional path segments that will be applied relative to the first argument. |
Returns:
CollectionReference<DocumentData>
The CollectionReference
instance.
Exceptions
If the final path has an even number of segments and does not point to a collection.