So here are the available triggers for Firestore cloud functions:
https://firebase.google.com/docs/firestore/extend-with-functions
onCreate
functions.firestore
.document('my-collection/{doc-id}')
.onCreate((snap, context) => { /* ... */ });
onDelete
functions.firestore
.document('my-collection/{doc-id}')
.onDelete((snap, context) => { /* ... */ });
onUpdate
functions.firestore
.document('my-collection/{doc-id}')
.onUpdate((change, context) => { /* ... */ });
onWrite
functions.firestore
.document('my-collection/{doc-id}')
.onWrite((change, context) => { /* ... */ });
I'm converting my project to Typescript. What types should I use for the params change
context
and snap
?
function.firestore.document().onUpdate()
triggers. I was only adding this part inindex.ts
where I was importing and re-exporting them inside the triggers. But will use it like this from now on. – cbdeveloper