Firestore Document Limit (Max Size, Number of Fields, etc.)

June 27, 2019

Firestore Document Limit

  • Max document size: 1 MiB (1,048,576 bytes)
  • Max size of document ID: 1,500 bytes (Document ID must be UTF-8: if using only ASCII characters, it support up to 1500 characters)
  • Max size of field name/path: 1,500 bytes, including list/map path. e.g. person.location.address = 23 bytes
  • Max size of field value: 1 MiB - 89 bytes (1,048,487 bytes)
  • Maximum depth of fields in a map: 20
  • Maximum write rate to a document: 1 per second
  • Maximum number of index entries for each document: 40,000 (single-field index entries and composite index entries)
  • Maximum number of fields:
    • Each field is created with 2 index by default (ascending & descending), thus maximum number of fields is 20,000 (limited by max index entries)
    • If composite index are used, less than 20,000 fields are supported
    • If no index is created (using Index Exemptions), assuming each field is 100 bytes, maximum of 10,485 fields is supported (limited by max document size)

NOTE: I suspect document size include field name + value (I have yet to found a reference or tested on this).

NOTE: Note that each UTF-8 characters could be between 1-4 bytes.

References:

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.