How can I optimize Firebase Firestore request when there are thousands of documents?
I developed a web page in NextJS that gets surveys stored in a Firestore database and renders the data as different charts, this page is used by some clients which generates some surveys per month, but there is one client that generates thousands of surveys and is increasing the loading time of the page because of this and the current approach it uses to get the data from the db, below you can see the function that does that: