toFirestore method

JSObject toFirestore(
  1. JSObject modelObject, [
  2. SetOptions options
])

Called by the Firestore SDK to convert a custom model object of type AppModelType into a plain Javascript object (suitable for writing directly to the Firestore database) of type DbModelType.

To use set() with merge and mergeFields, toFirestore() must be defined with Partial<T>.

The WithFieldValue<T> type extends T to also allow FieldValues such as FieldValue.delete() to be used as property values.

Implementation

external JSObject toFirestore(JSObject modelObject, [SetOptions options]);