I'm creating an e-commerce site, and the main page has a list of recent/featured products.
Since Firestore charges based on document reads, I had the idea to daily create a large document that collects all the products that'll show on the home page, and have the app just load this single document. That way main page views would cost less.
Is there a name for this pattern, or anything in particular I should consider for it? If there are any resources you could link to, that would be helpful.
Thanks!
Storing partially rendered content is indeed a valid approach to reduce the cost/complexity of reads, and on Firebase's Realtime Database I usually describe it as modeling the screens of your app in the database.
The approach is a bit less common on Firestore, due to the performance guarantees there, but still equally valid and indeed a great counter against needing to read the same M documents for each of your N users. I usually call it an aggregation document, but there's nothing official about that term. Calling it a cached query snapshot might actually be more accurate in the context of Firestore.
Another (more recent) approach to accomplish the same cost reduction is to use data bundles, which allow you to read a bunch of documents from the database server once, distribute them to multiple clients, and then insert them into the local cache of those clients.