Skip to content

Instantly share code, notes, and snippets.

@aakash14goplani
Last active December 7, 2021 19:44
Show Gist options
  • Save aakash14goplani/5ec7ca9362f86234a80516db814021e8 to your computer and use it in GitHub Desktop.
Save aakash14goplani/5ec7ca9362f86234a80516db814021e8 to your computer and use it in GitHub Desktop.

Why Learn Firebase Firestore?

NoSQL Support:

  • Cloud Firestore is a scalable NoSQL cloud database for mobile, web, and server development from Firebase and Google Cloud Platform.

Realtime Updates:

  • Like Realtime Database, Cloud Firestore uses data synchronization to update data on any connected device.

Expressive Queries:

  • It is designed to make simple, one-time fetch queries efficiently.
  • In Cloud Firestore, you can use queries to get individual, specific documents or to get all the documents in a collection that match your query parameters.
  • Queries can include multiple filters and also filtering and sorting combined.

Offline Support:

  • The data that your app uses the most is cached so the app can interact with the data even if the device is offline.
  • When the device comes back online, Cloud Firestore synchronizes any local changes back to Cloud Firestore.

Flexibility:

  • Cloud Firestore data model supports flexible data structures.
  • You can store your data in documents and organize them into collections.
  • It is important to mention that documents except subcollections can contain complex nested objects as well.

Designed to Scale:

  • Cloud Firestore is designed to scale with automatic multi-region data replication and strong consistency.
  • It has been designed to handle the highest database workloads.

Create Firebase Project

  1. Go to https://firebase.google.com
  2. Click on "Go to Console" option on the header (right side).
  3. Click on + add sign to add new project.
  4. Name it as Employees and click on continue and create the project.

Enable Firebase Firestore

  • Once you have created a new project, you should be automatically redirected to Project Overview page. In Project Overview page, from Left Side of Navigation, click on Firestore Database and then click on Create Database button.
  • You'll see two options: (1) Start in production mode & (2) Start in test mode. Select production mode and click next button.
  • Choose the already selected option for Cloudstore Firestore Location and click Enable button.
  • Once you complete this step, click on Project Overview option from Left navigation bar.
  • Just below the project name i.e. "Employees", you'll see three options:
    1. Add Firebase to your IOS App
    2. Add Firebase to your Android App
    3. Add Firebase to your Web App -> we'll select this option
  • Enter the app nick name as "Employees"
  • Check the box against option Firebase Hoisting
  • Click on Register app button.
  • You'll see a script is generated and we have two options to utilize that script (1) use npm or (2) use script tag, we'll select second option and add this to our HTML file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment