I just added Cloud Function functionality to my Firestore Project and I was able to follow the docs and get the hello world https endpoint call to work. My question now is how do I start actually using cloud functions to update data in my database? Currently my Firestore structure is as follows:
Users(Collection)->{user_unique_id}(document)->budget(collection)->[data/general](two different documents).
So I want a function to be called whenever either the data or general documents are updated that takes all of the data in both the data and general documents and runs some math, and then returns updated values for each document.
My question is, how do I actually do this? Right now I have tried functions.firebase.document("users/{userId}").onUpdate(), but this is not doing anything, and I am not sure how to get the currently used userId? On top of this, how could I make a function that I can just call regularly from a method in my app?
Thanks guys.