Skip to content

Firestore collection/document diagram

Collections, documents, fields, subcollections and references.

What it explains and when it is useful

Cloud Firestore is a document database. Data is stored in documents (sets of fields), grouped into collections. A document can hold subcollections, and fields can reference other documents. This diagram shows that structure with real field names, types and ID choices.

When to use it: Solutions that use Cloud Firestore (often with Firebase Authentication in web or mobile apps).

Worked example

Illustrative: PracticePal is a fictional project used throughout this guide.

Alternative scenario. The main PracticePal uses SQLite. This shows how its data could be organised if it used Cloud Firestore instead.

Firestore collection and document diagram for an alternative PracticePal that stores its data in Cloud Firestore: rooms, students and waitlists collections; each room document has a bookings subcollection; booking documents hold a reference to a student documentroomscollectionP5documentname: "Drum room" stringloudAllowed: true booleanneighbours: ["P4", "P6"] arraybookingssubcollectionXr4tQ81bZauto-IDstudentRef: /students/u381 referencestart: 3 Nov 2026 12:30 timestampend: 3 Nov 2026 13:00 timestamploud: true booleanstatus: "confirmed" stringpath: rooms/P5/bookings/Xr4tQ81bZstudentscollectionu381ID = login uidname: "Maya L." stringemail: "m.l@school.org" stringrole: "student" stringreference (not a copy of the data)waitlistscollectionP5_2026-11-03T12:30ID chosen: room + slotroom: "P5" stringslotStart: 3 Nov 2026 12:30 timestampqueue: [/students/u102, /students/u440] array of referencesDocument IDs are either chosen(P5, u381, P5_2026-…) so they can beread directly, or auto-generated(Xr4tQ81bZ) when nothing is unique.
PracticePal's data modelled in Cloud Firestore.

Scroll sideways to see the whole diagram.

Notation and legend

Symbol or partMeaning
Tab shapeCollection (or subcollection)
Folded-corner boxDocument, with its ID at the top
field: value typeA field, its example value and type
Dashed arrowA reference field pointing to another document
PathWhere a document lives: collection/doc/subcollection/doc

Design decisions it communicates

A diagram earns marks when you explain the decisions it shows. In PracticePal's documentation these would each be one sentence:

  • Bookings are a subcollection of each room, because the main query is “this room's bookings this week”.
  • Waiting-list documents use a chosen ID (room + slot), so the app can read one directly without a query.
  • Student details are referenced, not copied, so a name change happens in one place.
  • Firestore has no joins or UNIQUE constraints: the clash check must run in a transaction.

Common mistakes

  • Drawing an ERD with tables for a Firestore project.
  • Leaving out document IDs or how they are chosen.
  • Confusing Firestore with Realtime Database (different data models).
  • No field types.
Often confused with: Realtime Database JSON tree. Firestore stores documents in collections and queries collections. Realtime Database stores one JSON tree and reads data by path. Draw the model of the product you actually use.

Checklist for your own version

Ticks are saved in this browser only, so you can use the list while you draft.