Firestore cycle for and update function are not in sync
I’m new to firestore cloud functions. I’m trying to write a function that based on the change of one collection should be updated the data of another collection. I create cycle for on the ingredients, the update function works, but it assign the last value of the for cycle to the “total_amount” and “partial_amount”. I.e. I have the ingredient “Zucchini” with 20 as amount and “Tomato” with 50 as amount and the update function assign 50 to both the document in aggregate_ingrdients collection instead the corresponding one. Seems the cycle for and the update function are not in sync. Could be an issue of async function? How can I solve it?
Google Firestore – how to send data to the frontend?
If I make a call from Node to Firestore like this:
Error 5: NOT_FOUND details: ” note: ‘Exception occurred in retry method that was not classified as transient’
I am trying to upload some data to a Firestore DataBase by running index.js with Node.js. This is part of the Google codelab to use GenAI with Firebase Genkit: https://github.com/FirebaseExtended/codelab-ai-genkit-rag/tree/main/load-firestore-data
TypeError: Cannot read properties of undefined (reading ‘serverTimestamp’)
I tried to use firestore.FieldValue.serverTimestamp() method to store timestamp value to my Firestore document. But I ended up with this error that I couldn’t find anywhere in the Firestore documentation, is it already deprecated? if yes, what’s the alternative? Here is the
Error messages