Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
821 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...