Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
775 views
in Technique[技术] by (71.8m points)

firebase - Is it possible to run aggregation queries in Firestore?

Stack:

Ionic
Nodejs/Express
Cloud Firestore

I am tasked with writing an app that takes dates in "day" format, with a balance for that day, and displaying that data in a chart using Chart.js. There are interval buttons that allow you to change between "day", "week", and "month" that is supposed to group the dates into respective intervals.

This currently works fine using 1 collection. "days" and "weeks" both work, but once we get to "month" with large amounts of data Firestore kills itself in my backend. The amount of data it tries to poll is too large. I currently run aggregation for "weeks" and "months" in the backend using the "days".

The only aggregation documentation I could find in the docs was: https://firebase.google.com/docs/firestore/solutions/aggregation which doesn't give me a result, it stores it in a collection which doesn't help me. The app can change the balance on a single date which causes a ripple effect in the balances after the fact - so I have to generate the values on interval change.

Does something like this exist or am I stuck with creating 3 separate collections, days/weeks/months and polling the desired collection?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...