Home > @firebase/firestore > lite > DocumentReference
DocumentReference class
A DocumentReference
refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist.
Signature:
export declare class DocumentReference<T = DocumentData>
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
firestore | FirebaseFirestore | The FirebaseFirestore the document is in. This is useful for performing transactions, for example. | |
id | string | The document's identifier within its collection. | |
parent | CollectionReference<T> | The collection this DocumentReference belongs to. |
|
path | string | A string representing the path of the referenced document (relative to the root of the database). | |
type | (not declared) | The type of this Firestore reference. |
Methods
Method | Modifiers | Description |
---|---|---|
withConverter(converter) | Applies a custom data converter to this DocumentReference , allowing you to use your own custom model objects with Firestore. When you call setDoc(), getDoc(), etc. with the returned DocumentReference instance, the provided converter will convert between Firestore data and your custom type U . |
|
withConverter(converter) | Removes the current converter. |