hello everyone.
I’m facing a strange issue with saving data to firestore.
Everything works well except phone number field, firestore saves phone number as number, ok, i understand the logic, but my app at the other end waiting string.
what you can do is change the data type, if it’s a string and you want to change it to number, you can just add .toNumber() function but if it’s from number to string, use .toString()
just make sure that if you want to change string to number, that everything inside is a number, so not “+90…” but instead “90…”
I dont think it works like that. The firestore node automatically tries to determine the data type when it stores the document. This is super annoying as it will change any string number into a number type, meaning values leading with zeros get chopped off. The only way I have gotten around this is to prefix numbers with an underscore and then slicing it when I read the value again.
I can confirm this issue, it seems like the firestore node doesn’t respect the type, this is also causing me issues. One of the issues with this node is that it doesn’t allow you to specify key:value pairs, only the keys. If it was more setup like the set node, then we could ensure values are properly typed.
Correct. It’s in the codebase if you go look at line 88 of the below function for the firestore built in node. It tries to determine the best data type based on the value, instead of respecting the type you might have tried to set from n8n: