Home > @firebase/firestore > lite > CollectionReference > withConverter
CollectionReference.withConverter() method
Applies a custom data converter to this CollectionReference, allowing you to use your own custom model objects with Firestore. When you call addDoc() with the returned CollectionReference instance, the provided converter will convert between Firestore data and your custom type U.
Signature:
withConverter<U>(converter: FirestoreDataConverter<U>): CollectionReference<U>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| converter | FirestoreDataConverter<U> | Converts objects to and from Firestore. |
Returns:
A CollectionReference<U> that uses the provided converter.