Skip to content
Advertisement

Get field type of document field from firestore

Is it possible to get the field type of a field in a document?

I want to create a function that looks something like this:

JavaScript

Where field.type returns the type of the field. For example it should return something like this:

JavaScript

Advertisement

Answer

From the document snapshot, with document.get you can get the field value as an Object and then in Python from this object you can the get the type with type() function.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement