Google Firestore database

The Google Firestore database is part of Google Cloud Platform. The official website of Google Cloud describes it as follows:

Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL document database that simplifies storing, syncing, and querying data for your mobile, web, and IoT apps on a global scale. Reference: https://cloud.google.com/firestore/

Firestore is a database as a service offered by Google and offers an easy-to-use NoSQL document database. Since Firestore is also coming from the makers of Angular, it's natural that there are libraries that support easy integrations between the two. In this section, we will learn how to set up the Firestore database. So, let's begin:

  1. We will need to log in to our Firebase application using our credentials. Upon successful login, we should see the welcome screen, as displayed in the following screenshot:

The home page will list all the projects we created in the Firebase application, and you will also notice a big Add project link. 

  1. Now, let's create a new project for our application by clicking on the Add project link.We will be prompted by a modal window where we need to enter a Project name for our project, as shown in the following screenshot:

Here, we will enter Listings as our project name. Once our project has been provisioned, we will be taken to the newly created project page.

  1. We now click on Databases in the sidebar menu. We will be prompted to select the mode in which we will initialize our database. We will select the test mode for our testing, and once we have performed the implementation, we will switch the security mode:

As shown in the preceding screenshot, we are using a database in test mode, which will allow us to read or write documents easily.

Do not forget to change the settings of the database if you want to use the database in a production environment.

  1. We'll now move on to create our comments collection. We'll add a unique identifier called commentId. In addition, we are adding three fields as a schema for the documents that will be stored in the collections, as shown here:

Since Firestore is a NoSQL document database, the schema is not restricted by any data types. We can now perform CRUD operations, such as adding a new document, editing, or even deleting documents, in the Firestore database.

In the last two sections, we have learned about creating fake APIs using the JSON Server, and we have also created a NoSQL document database using Firestore. Now that we have reached a stage where we have learned about all the fundamental concepts needed to start implementing the end-to-end functionality of our ListingApp, let's jump into the HTTP world!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.255.134