Cloud Firestore vs Reatime Database

What is Firebase?

It is Google’s web and mobile application development platform that helps to develop high-quality Apps. Firebase is the backend of your apps which includes many features like cloud storage, realtime database, user authentication, static hosting and many more. Firebase offers two types of client-accessible, cloud-based database solutions for mobile apps that support realtime data syncing.

— Real-time Database
— Cloud Firestore

What is Real-time Database??

Realtime Database is the first and original cloud-based database and is the well established product of Google’s Firebase. It is an efficient and low-latency solution, for the mobile apps requiring synced states across clients in realtime.

What is Cloud Firestore?

Cloud Firestore is the new flagship database of Firebase used for mobile app development. Firestore comes with better scalability, richer features and faster queries and makes it a more intuitive model of Firebase. Though it is promising improvised technologies, it is still in beta testing stage.

Comparison:

Real-time Database

Cloud Firestore

Realtime and offline support

Offline support for only the Android and iOS mobile clients.

Offline support for Android, iOS and web clients as well.

Data model

Data stored as one large JSON tree.

Data is stored in the form of documents and are organised in collections.

Querying

Provides deep queries with limited sorting and filtering functionality. The developers can either sort or filter on a property in a single query.

Provides shallow queries. It indexes query with compound filtering and sorting. Allows filtering and sorting in a single query.

Writes and transactions

Provided basic writes and transaction options.

Provided advanced writes and transaction options.

Scalability

Sharding is required for scaling.

Shards data over 100000 concurrent connections. Requires sharding data across multiple databases.

Scaling will be automatic without the need of sharding.

Security

The firebase database rules are the only security options. Developers need to validate data separately using ‘validate’ rule.

Uses Identity and Access Management (IAM). Data validation happens automatically.

Pricing

Charges only for bandwidth and storage at a higher range.

Charges primarily on operations performed in database (Read, write, delete) , bandwidth and storage at a lower range. supports daily spending limits for Google App Engine projects.