Firestore insert document query in workflow stores {{ moment() }} as string instead of timestamp

Hello,
I've encountered an issue regarding storing timestamps in Firestore documents.

When I execute a query through the normal editor, triggered by a button click, the current date is stored correctly as a timestamp in my Firestore document:


However, the problem arises when I use a workflow. Within a loop block in the workflow, I employ a Firestore insert document query with the same JSON value for insertion. Unfortunately, during the execution of this workflow, the timestamp is saved as a string instead of a timestamp format in the Firestore document:


image

This discrepancy is puzzling since the same query, when used in a workflow versus in the editor, results in different behaviors for storing a timestamp. My expectation is for consistent behavior across both methods: the {{ moment() }} function should store the current time as a timestamp in both cases, not as a string.

I would appreciate any guidance or solutions to ensure uniform behavior. Thanks!

Hey @jensbecker!

Your best option here is to use custom libraries with the Firebase SDK since there’s no raw firestore option in Workflows. With that said, custom libraries will be supported soon :+1:

Hi @victoria , any updates on this?

I am encountering this issue now as well...

Hello @Dan_Merry!

Unfortunately Victoria is no longer on the team :smiling_face_with_tear:

This has been an issues faced by other Retool users, one work around that had been suggested was using RAW mode for the query.

There is another forum post on this issue that might have some unique work arounds that could help.

From my understanding Retool sends timestamps to Firestore, but on their end the timestamp is being converted to a string, which unfortunately we are not able to control.

There are options in the forum post I linked above for converting the strong stored in Firestore back to a moment object once it is fetched by a Retool query.