The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > lite > 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). Used with setDoc(), and with merge:true or mergeFields.

Signature:

toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData;

Parameters

Parameter Type Description
modelObject Partial<T>
options SetOptions

Returns:

DocumentData