0

According to Firestore, the max document size is 1MiB. In my app, every user has his own document. So can every user have a maximum storage size from 1 MiB or do I understand this wrong?

Because in my app the user can input a lot of data, so I fear that the Storage is not enough. How to handle this problem?

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Dalon
  • 566
  • 8
  • 26
  • You had initially tagged this with Google Cloud Storage so it seems like you might be conflating two concepts of documents (like what you might see in google drive) and a firestore document (an entry in a database). It's unclear from your question as to what a user can input. Most likely, the entirety of a user's input, whatever that is, would not be stored in a single firebase document. – imjared Aug 12 '21 at 13:54
  • I only use firestore and not google Cloud, sorry for the confusion – Dalon Aug 12 '21 at 13:57
  • It's still not clear what kind of data you expect your users to enter and why you'd be storing all of that in a single Firestore document. If you don't think you'd be able to fit everything, you need to rethink your architecture. – imjared Aug 12 '21 at 14:03
  • I postet a picture of what it looks like, hope this helps to understand my question – Dalon Aug 12 '21 at 14:14
  • The question is really impossible to answer with the limited data you've given us. For example; *why* does a user "has his own document' - that's an unusual way to structure your data as most of the time, data is spread out amongst logical groupings of collections/documents. I would suggest reviewing [NoSQL Data Modeling](https://firebase.google.com/docs/) Then update the question with details and code you're attempted. Also see [Data Modeling](https://stackoverflow.com/questions/56912654/firebase-is-it-a-good-idea-to-use-dimension-fact-table-design-in-nosql/56914411#56914411) – Jay Aug 12 '21 at 17:32

1 Answers1

1

So can every user have a maximum storage size from 1MiB or do I understand this wrong?

Yes, that's correct. You are limited to 1 MiB for each document.

Because in my App the user can input a lot of data, so I fear that the Storage is not enough

If you are afraid of reaching the limit, then you should consider storing the data in other collections as well. In your case, I would create a collection of "plans" as well as one of "todos". In this way, you aren't limited in the number of documents you can add to a collection.

How to handle this problem?

For Android, there is a library called FirestoreDocument-Android, which will help you check against the maximum of 1 MiB (1,048,576 bytes) quota.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193