How can I force data type in firestore?

Hello I want to force string datatype when create /upsert data in Firestore database even for those fields that can be converted to integer.

I.e, if I set “5” it is using int automatically, but I’d like this to be stored as string. The only way I’ve found is concatenating some random string

I’m trying also to add some DateTime data to my firestore collection, but all that I can insert from n8n is string or, if I send the data as timestamp, it is stored as int.

Any clues?

Hi @Albuendi, welcome to the community!

I am afraid it’s not currently possibly to directly insert a number as string using n8n’s Firestore node. That’s because n8n will run this function behind the scenes using isNaN(). This method also identifies strings as numbers. You might want to raise a feature request to allow manually specifying the data type here so we can consider adding this functionality in the future.

The same function will also discover dates. It works for me as expected though, the below workflow inserts a timestamp:


Perhaps you can share an example of the date value you can’t currently insert as a timestamp?

Thank you very much @MutedJam. It works by using ISO as per your example. :+1:

Regarding inserting numbers as string, I’ve started playing around with n8n a couple weeks ago, I guess I can live without it for now, I will use some workaround.
If absolutely needed, I will try to create a push request :rocket:

Best, and thank you so much for your help.