'How to trigger event on field change in Firestore | Cloud Functions [duplicate]

I am trying to trigger an action only if a specific field in a document changes.

Let's say the following Firestore structure is given:

  • events
    • eventID
      • title: "Party"
      • invitations:
        • userID_1
        • userID_2

I now would like to trigger an action if the invitations array is being updated. So far I can only find that triggers can be applied to a document (eventID in this case), but not to a field. Is there no possibility to have a trigger on a specific field.

I am working with TypeScript instead of JavaScript.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source