veritatisdoloremque
Version:
Monorepo for the Firebase JavaScript SDK
27 lines (15 loc) • 1.15 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/firestore](./firestore.md) > [/](./firestore_.md) > [CollectionReference](./firestore_.collectionreference.md) > [withConverter](./firestore_.collectionreference.withconverter.md)
## 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()](./firestore_.adddoc.md) with the returned `CollectionReference` instance, the provided converter will convert between Firestore data and your custom type `U`<!-- -->.
<b>Signature:</b>
```typescript
withConverter(converter: null): CollectionReference<DocumentData>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| converter | null | Converts objects to and from Firestore. |
<b>Returns:</b>
[CollectionReference](./firestore_.collectionreference.md)<!-- --><[DocumentData](./firestore_.documentdata.md)<!-- -->>
A `CollectionReference<U>` that uses the provided converter.