Syed Saad Qamar
Software Engineer

/SyedSaadQamar96

/in/syed-saad-qamar

/saadqamar01

/saadqamar96

Cloud Firestore

Introduction to Firestore

  • Flexible
  • Scalable Database
  • Realtime Database
  • Offline Support
  • NoSQL database
  • Serverless

Firebase is a Google owned cloud based system that comes complete with API hooks, file storage space, auth system and hosting capabilities. Firestore is also

Realtime Database VS Cloud Firestore

Realtime database is Firebase's original database. It's an efficient, low-latency solution for mobile apps that require synced states across clients in realtime.

Cloud firestore improves on the successes of the Realtime Database with a new, more intuitive data model. Cloud Firestore also features richer, faster queries and scales better than the Realtime Database.

Realtime Database

Cloud Firestore

Realtime Database VS Cloud Firestore

Data model

  • Stores data as one large JSON tree
  • Simple data is very easy to store
  • Complex, hierarchical data is harder to organize at scale
  • Stores data in the form of documents which are organised in collections
  • Simple data is easy to store in documents, which are very similar to JSON
  • Complex, hierarchical data is easier to organize at scale, using subcollections within documents.

Realtime Database VS Cloud Firestore

Realtime and offline support

Both have mobile-first, realtime SDKs and both support local data storage for offline-ready apps.

Offline support for mobile clients on iOS and Android only.

Offline support for mobile clients on iOS and Android only.

Realtime Database VS Cloud Firestore

Querying

  • You can only sort or filter on a property, not sort and filter on a property, in a single query.
  • Queries are deep by default: They always return the entire subtree.
  • You can chain filters and combine filtering and sorting on a property in a single query.
  • Write shallow queries for subcollections
  • Queries are indexed by default: Query performance is proportional to the size of your result set, not your data set.

Realtime Database VS Cloud Firestore

Writes and transactions

  • Transactions in the native SDKs require a completion callback.
  • Transactions automatically repeat until they're completed.

Text

Realtime Database VS Cloud Firestore

Reliability and performance

Realtime Database is a regional solution.

  • Very low latency, so it's a great option for frequent state-syncing.
  • Databases are limited to zonal availability in a single region.

Cloud Firestore is a multi-region solution that scales automatically.

  • Multiple data centers in distinct regions, ensuring global scalability and strong reliability.
  • Offers the stability and reliability of the Google Cloud Platform.

Realtime Database VS Cloud Firestore

Scalability

  • Scale to around 100,000 concurrent connections and 1,000 writes/second in a single database. Scaling beyond that requires sharding your data across multiple databases.
  • Scales completely automatically. Currently, scaling limits are around 1 million concurrent connections and 10,000 writes/second. We plan to increase these limits in the future.

Firestore CRUD Function

 

CRUD — Create, Read, Update, Delete:

The four important functions of database actions. They are the only things you’ll ever need to do anything significant with your database. Sure, you can increase the complexity of the queries but at the end of the day, it all boils down the these four actions.

Firestore CRUD Example

 

Let's do some code

THANK YOU!

Firestore

By Syed Saad Qamar

Firestore

  • 320