Firestore's data tree
Firestore stores data as documents grouped into collections. The tree always alternates: collection, document, collection, document.
Database and collections
The database root holds only collections, such as users and posts. A collection is just a container of documents and has no fields of its own.
Documents
Each document has an ID unique within its collection, like users/alice. Documents are schemaless, so siblings can have different fields, and each is limited to 1 MiB.
Fields and types
A document's data is key-value fields: strings, numbers, booleans, timestamps, arrays and nested maps. Maps live inside the document and are read with it.
Subcollections
A document can own subcollections, like users/alice/orders. Reads are shallow: fetching alice does not fetch her orders, which keeps documents small.
References
A reference field stores another document's path. There are no joins, so the app reads the referenced document in a separate request, or duplicates data it needs often.
Queries and listeners
Apps query a collection and can attach snapshot listeners, so changes to documents stream to the client in real time.