‫Welcome back.
‫In this video we'll start learning about Cloud Firestore.
‫Cloud Firestore is a NoSQL document database offered as part of Firebase, designed to store, synchronize
‫and query data for your applications in real time, making it a powerful tool for building scalable
‫and responsive applications.
‫Cloud Firestore is document oriented, meaning data is organized into collections and documents.
‫Each document is a Json like object containing key value pairs and NoSQL.
‫It's a NoSQL database, which means it provides flexibility in data modeling.
‫You don't need to define a rigid schema in advance, allowing you to adapt your data structure as your
‫app evolves and real time data sync.
‫Cloud Firestore provides real time data synchronization when data changes in the database, clients
‫connected to it receive updates in real time, making it ideal for building collaborative and interactive
‫applications.
‫In Firebase Firestore, data is organized into two main structures documents and collections.
‫Understanding these concepts is essential for effectively modeling and retrieving data in Firestore.
‫Let's start understanding these concepts.
‫The document A document is the basic unit of data in Firestore.
‫It's a set of key value pairs where each value is a field or attribute name, and each value can be
‫various data types including strings, numbers, booleans, maps, arrays, timestamps, and more.
‫Documents are analogous to rows in traditional relational database, but they are schemaless, meaning
‫each document within a collection can have different fields.
‫Each document must have a unique identifier within its collection, typically called document ID.
‫You can either manually specify the document ID or Firestore can generate one for you.
‫Documents are usually used to represent individual items or entities, such as a user profile, a product,
‫or a message.
‫For example, this is a user first name Jack Last Richard born 1992.
‫So the document represents a user.
‫Have the following schema A collection is a group of related documents.
‫Collection can be thought of as containers or tables in which you organize your data.
‫Each collection has a unique name.
‫Within a Firestore database.
‫Collections are analogous or similar to tables in traditional relational databases, but they are not
‫required to have a fixed schema.
‫You can nest collections within other collections.
‫Creating a hierarchical structure for your data.
‫Collections are used to organize documents and provide a convenient way to query and retrieve data based
‫on common criteria.
‫For example, you might have a users collection to store profiles and messages, collection to store
‫chat messages, and for example, here we have the collection users to store the user's collection of
‫users first name, last name, and their born year.
‫The second user in the same John Travolta 1982, and so on.
‫So users is a collection and user number one is a document.
‫Again, guys, documents within the same collection can have different fields, and collections are
‫used to group related documents together.
‫Firestore allows for rich querying of documents within a collection based on field values, making it
‫easy to filter and retrieve data that meets specific criteria.
‫When designing your Firestore data structure, it's crucial to consider your application's data access
‫patterns, how you plan to query and retrieve data.
‫Firestore flexible data model allows you to adapt your database structure to fit the needs of your application
‫as it evolves.