I have these requirements:
Collections in Firestore:
- Users (id, name, email)
- Transactions (id, userId, value, status)
Supposedly I wanted to show the last 1000 transactions in my admin panel, every time I open the admin dashboard:
- transaction 1 : {Andy, 100, pending},
- transaction 2 : {Budi, 200, ok},
.........
- transaction 1000 : {Charlie, 300, pending},
What is the best way to query for transactions and also the related name from the user on the Firestore?
One way is, I could read all transactions, and then for each transaction, I get the doc value from user collection, but that could result in 1001 read calls instead of 1 read call right?
Is there any efficient way without wasting 1000 of my firebase free read count every time I open the admin panel?
In SQL this should be the equivalent of JOIN