Is there an event timestamp available in the firestore `onDelete` function?

Viewed 24

If I'm using a firestore function triggered on firestore database events such as onUpdate() or onCreate(), for most writes I can check the change.after.updateTime field to see when the write occurred, which will be different than Timestamp.now(), the time the function is invoked.

However, when the document is deleted, triggering onWrite() or onDelete(), change.after.exists is false and change.after.updateTime is undefined. Is there any way to get access to the time that the database event occurred, rather than the time that the function is invoked?

1 Answers

Currently there is no information about when the exact transition occurs available for such a delete operation. You'd have to pass or get something out of band (i.e. writing it into a separate document, or somehow reading it from the logs), but I can imagine how that'd get pretty hairy quickly.

I recommend filing a feature request for this with the team.

Related