Jump to top

FirestoreDataConverter

interface

Converter used by withConverter() to transform user objects of type T into Firestore data.

Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore.

Methods

fromFirestore

</>

Called by the Firestore SDK to convert Firestore data into an object of type T. You can access your data by calling: snapshot.data(options).

fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): ;

toFirestore

</>
Signature 1
</>

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>.

toFirestore(modelObject: ): DocumentData;
Signature 2
</>
toFirestore(modelObject: Partial<>, options: SetOptions): DocumentData;