Home > @firebase/firestore > / > FirestoreDataConverter > toFirestore
FirestoreDataConverter.toFirestore() method
Called by the Firestore SDK to convert a custom model object of type T
into a plain JavaScript object (suitable for writing directly to the Firestore database). To use set()
with merge
and mergeFields
, toFirestore()
must be defined with Partial<T>
.
Signature:
toFirestore(modelObject: T): DocumentData;
Parameters
Parameter | Type | Description |
---|---|---|
modelObject | T |
Returns: