I'm working on a side project and want to let my users check if their friends have accounts.
Currently I've implemented it like this:
- Read phone contacts for emails
- Loop through the emails
- Make
.get()
query on the user database1 for users with that email - If data comes back, the friend is on the platform and an invite button is displayed
- Make
- Free quota2 exceeded within an hour
The thing is that any .get
is considered a read operation, even if no data comes back. Their doc.exists
can only be tun after a .get
so a document read is needed to check for existence.
I'm sure I'm overlooking something obvious, what I want to do is in essence to an .exist() like query that does not 'cost' a read.
1: I'm not actually storing emails in firestore but their hashes, and am querying those. Same effect, but it allows me to query a secondary user database that doesn't expose true emails and other data.
2: Not trying to be cheap per se, but if this app turns commercial this would make the billing a nightmare.