Replies: 2 comments 1 reply
-
Hi everyone, I'd like to further elaborate on the cost aspect of Firebase Firestore. Firestore's pricing model is based on the number of reads, writes, and deletes, rather than the amount of data stored. While this seems straightforward, it can lead to unexpected costs if not carefully managed. For instance, suppose our app has a feature where a user can like a post, and we have implemented it in such a way that every like increments a 'likeCount' field in the post document. If we have a large user base, this could quickly result in a significant number of writes, thus increasing costs. On the other hand, Firestore's pricing model can also be an advantage in certain scenarios. If we structure our data efficiently, we can minimize the number of reads/writes required for each operation, effectively controlling costs. For example, in the proposed group data structure:
Instead of keeping an array of user IDs in each group document (which could lead to a high number of reads/writes every time a user joins or leaves a group), we could create a separate 'groupMembers' collection where each document represents a user's membership in a group. This would allow us to only read/write documents that are directly relevant to the operations being performed, thus optimizing costs. In summary, while Firestore's pricing model has its challenges, with careful data modeling and efficient querying, we can mitigate potential cost issues. I'd love to hear any other strategies or experiences you've had with Firestore's pricing! |
Beta Was this translation helpful? Give feedback.
-
Firestore is a NoSQL database and has two primary data types: collections and documents. Collections are containers for documents, and documents are individual entries containing fields (which hold the data). Here are a few ways you can structure your user and group data in Firestore:
|
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I would like to open a discussion on the use of Firebase's NoSQL database Firestore for our project. I believe this platform could provide several advantages for our specific needs, but it also comes with some potential drawbacks.
Pros:
Real-time updates: Firestore can push updates to the client in real-time. This can be a significant advantage for features that require live updates.
Scalability: Firestore is built to scale automatically, which could be beneficial as our user base grows.
Integration with other Firebase services: Firestore can be seamlessly integrated with Firebase's other offerings, like Authentication, Storage, and Cloud Functions.
Strong SDKs and Libraries: Firebase provides powerful SDKs and libraries that allow for easy integration into various platforms including Android, iOS, and Web.
Cons:
Complex Queries: Firestore has certain limitations with complex queries, unlike SQL databases which allow for complex joins and aggregations.
Cost: Firestore charges based on the number of reads, writes, and deletes. Depending on the usage pattern, this can become costly.
Data Structure: NoSQL databases like Firestore require careful planning of data structure. Since it's a document database, you have to consider how data is nested or referenced.
For our project data, I propose structuring it as follows:
Users Collection:
Groups Collection:
This structure would allow us to efficiently fetch user and group information while minimizing document reads.
I would love to hear your thoughts and suggestions on this. Do you think Firestore is a good fit for our needs? Is there anything we should consider in structuring our data?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions