toData()function

toData(fields: FirestoreFields | undefined, caller: AnyCaller = toData): Data
ParamType
fieldsFirestoreFields
The Firestore fields object to convert (missing means an empty document).
callerAnyCaller
Caller function used to attribute thrown errors. Defaults to toData
Return
Data
The plain data object.
Throws
unknown
ValueError if any field value has no recognised type.

Convert Firestore REST API document fields back to a data object.

Examples

toData({ num: { integerValue: "123" } }) // { num: 123 }