Home > Enterprise >  Firebase Error: Document Exceeds 1MB size limit. How to work around it?
Firebase Error: Document Exceeds 1MB size limit. How to work around it?

Time:11-15

I'm having this problem when trying to register a user on the database. The database template is a document specific to the registered user in which it has 3 arrays of objects.

I searched on the internet a little bit about it, and people seemed to say that creating a subcollection would solve it, but I don't get how it would solve the problem nor avoid it happening again in the future when theses arrays grow bigger since the subcollections are also limited by 1MB of size limit, or even needing to make multiple fetchs instead of only one if I understood it correctly.

I believed firestore was a database. Isn't it one? How can't I store data in a database then, being so limited? What's the logic behind Firestore for doing that?

And if so, how do I get around it so it never happens again?

CodePudding user response:

The size limit of 1MB applies to each individual document. Subcollections are not part of it.

Also see:

  • Related