I need to delete all Documents which have a timestamp (stored in a field) prior to today.
The timestamp is created in the Firestore GUI. The following query doesnt retur
Whenever passing a date to Firestore, you should pass in an actual Date
object. Date.now()
returns a timestamp, which is just a number and not a Date
object itself. To get the actual Date
for the same value, use new Date()
. So:
collectionRef
.where('timestampFieldName', '<', new Date())
.get()