Search code examples
firebase-storagegoogle-cloud-firestore

Maximum size of a document in firestore?


I want create a document that containing about 20 million objects.

The structure like that:

documentID
---- key1
-------- object1
-------------name: "test1"
-------------score: 123

I don't know the limitation of a document size in firestore, so can you help me any reference or information about that? Thanks!


Solution

  • The maximum size is roughly 1 Megabyte, storing such a large number of objects (maps) inside of a single document is generally a bad design (and 20 million is beyond the size limit anyway).

    You should reconsider why they need to be in a document, rather than each object being their own document.

    Cloud Firestore's limits are listed in the documentation.