I've been using firebase with cloud functions recently and this question popped into my mind.
If in my cloud function, using the Firebase Admin SDK, perform multiple reads to the same document in a single function call, will it count as multiple reads in the database or will it cache the data?
Example:
await admin.firestore().collection("users").doc("user_id_here").get();
await admin.firestore().collection("users").doc("user_id_here").get();
await admin.firestore().collection("users").doc("user_id_here").get();
Will this code above cause multiple reads or only one?
The Firebase/Cloud server SDKs don't do any persistent caching like the Firebase client SDKs. What you've written will perform three document reads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With