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 > doc

doc() function

Gets a DocumentReference instance that refers to the document at the specified abosulute path.

Signature:

export declare function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;

Parameters

Parameter Type Description
firestore FirebaseFirestore A reference to the root Firestore instance.
path string A slash-separated path to a document.
pathSegments string[] Additional path segments that will be applied relative to the first argument.

Returns:

DocumentReference<DocumentData>

The DocumentReference instance.

Exceptions

If the final path has an odd number of segments and does not point to a document.