...

/

Understanding the Cloud Firestore Structure

Understanding the Cloud Firestore Structure

Get a better understanding of the Cloud Firestore structure in this lesson.

The Cloud Firestore Data model

Cloud Firestore is a document-model database that uses a hierarchical data structure to store data. We can store data in Cloud Firestore as documents, collections, or subcollections.:

Documents

A document is a lightweight unit of storage made up of a set of key-value pairs. Each document in the database is identified by a name and supports various data types—strings, numbers, booleans, arrays, nested objects (called maps)—and subcollections. Data stored in documents typically looks like JSON and can therefore be treated as lightweight JSON records. The illustration below shows two Firestore documents, message1 and message2, containing data.

Collections

A collection is a container for documents. It organizes data and helps build efficient queries. In other words, documents in Cloud Firestore live inside collections. For example, we can have a messages collection that contains messages of a particular chat. Each message in the chat is represented by a ... ...

Access this course and 1400+ top-rated courses and projects.