I’m developing a dating app using Firestore as my database. I’ve structured my data such that each user has a separate collection under users->user_id->unseen_profiles
. This collection stores the profiles that a user has not yet seen.
The challenge I’m facing is that as the number of users grows (potentially to over 100,000), the number of documents I need to read and write grows exponentially. For example, to join each user, I would need to read and write to 200,000 documents. This is not only impractical but also costly considering Firestore’s pricing model.
Additionally, I need to ensure that a user does not see the same profile twice. This means that every time a user opens the app, I need to filter out the profiles they’ve already seen from the new profiles.
I’m looking for a more efficient way to structure my data and optimize my queries to reduce the number of read and write operations, while still ensuring that users don’t see the same profile twice. Any suggestions or best practices would be greatly appreciated.
I’m looking for a more efficient way to structure my data and optimize my queries to reduce the number of read and write operations, while still ensuring that users don’t see the same profile twice. Any suggestions or best practices would be greatly appreciated.