Home > @firebase/firestore > / > DocumentReference > withConverter
DocumentReference.withConverter() method
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.
Signature:
withConverter<U>(converter: FirestoreDataConverter<U>): DocumentReference<U>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| converter | FirestoreDataConverter<U> | Converts objects to and from Firestore. |
Returns:
A DocumentReference<U> that uses the provided converter.