In this Cloud Firestore documentation, it seems like the sum() aggregation is only for the client side. Is there any way I can run the sum() aggregation inside cloud functions using the Admin SDK?
In this Cloud Firestore documentation, it seems like the sum() aggregation is only for the client side. Is there any way I can run the sum() aggregation inside cloud functions using the Admin SDK?
2
Answers
As @Frank van Puffelen mentioned, the sum() Node.js sample in the Firebase guide is not for Firebase Admin Node.js SDK but for the Google Cloud Node.js SDK. Therefore, the sum() aggregation is not available in the current Admin SDK version(11.11.0).
Inside the official documentation regarding Firebase Admin SDK for Node.js, you’ll find an API for Firestore. Now, if you check the documentation related to the CollectionReference or Query, you’ll see that the count() function already exists but there is no
sum()
function present yet. I think it’s a matter of time until it will be added.