What is Cloud Firestore?

database representing Cloud Firestore

Databases support high-performance applications, whether on the web or on mobile. The best databases make storing information easy because they are well-organized. In addition, they provide functions that help automate various database management tasks, while making it easy to retrieve and manage data. A database-like tool, like Cloud Firestore, is essential for businesses across all industries.

Google Firestore is a popular database platform used by businesses around the world. The application development process is enhanced by real-time features and advanced data management. Let us discuss Google Firestore and how it can benefit developers.

 

Firebase Cloud Firestore Rules

 

Using Cloud Firestore Security Rules, you are freed from coding or managing infrastructure, so you can focus on building the best user experience.

Using security rules, you can control access to data and validate it without much effort. You need the security rules to create user and role-based access control systems for your users that keep their data safe.

  1. As of May 2019, Cloud Firestore security rules have been updated to Version 2. Use the recursive wildcard syntax, [name=**]Version 2, to apply rules to an arbitrarily deep hierarchy. The first line in your security rules must contain rules_version = ‘2’ to opt-in to Version 2.
  2. Each Cloud Firestore Security Rule has statements that identify your database’s documents and allow expressions that determine who has access to those documents.
  3. You can test your ruleset using Cloud Firestore’s rules simulator. Firebase’s console provides access to the simulator via the Rules tab in the Cloud Firestore section

Using the rules simulator, you can test authenticated as well as unauthenticated reads, writes, and deletions. In simulations involving authenticated requests, authentication tokens from a variety of providers can be built and previewed. Your editor runs the simulated ruleset, not the one you’re currently deploying.

  1. You must deploy security rules before you can access Cloud Firestore from your mobile app. Firebase CLI and Firebase console are both ways to deploy rules.

It takes up to a minute for changes to take effect on new queries and listeners in Cloud Firestore. There may, however, be a 10-minute delay before the new changes are propagated fully.

 

Pricing

 

Pay-as-you-go is the way Firestore charges its customers. This means that you will be charged more for using the product and vice versa. Initially, it is free, and only after some thresholds are reached will charges begin.

Prices are determined by a variety of factors, including:

  • Location of the database
  • Data storage
  • Bandwidth
  • Flow of operations

 

Document Pricing

Number of documents read (per 100,000): $0.06

Documents written (per 100,000): $0.18

Deleted documents (per 100,000): $0.02

Data Storage: $0.18 per GB

 

 

Cloud Firestore vs Cloud Storage

 

  • The Cloud Firestore provides more structured data than Cloud Storage and better querying. You can think of your data as a combination of documents (which are basically key-value stores) and collections (which are collections of documents). Subgroups are frequently included in documents, which themselves can contain other documents.
  • Built to Scale — The Cloud Firestore will scale better than Cloud Storage. Query scalability depends on the size of the data set, not your result set. Your data set won’t be affected by how large it gets, so searching will remain fast.
  • Stream in live data with Cloud Firestore using listeners just like the Cloud Storage. You can also use Cloud Firestore to fetch your data, and it’s built-in as a primary use case. 
  • Cloud Firestore charges on the basis of usage, while Cloud Storage charges on the basis of storage or network bandwidth. 
  • For apps and games that are more turn-based, such as Stack Overflow, Cloud Firestore looks attractive from a pricing point of view. It probably will be more expensive than Cloud storage for something like a real-time group drawing app in which you’re sending multiple updates a second to multiple people.

 

 

 

Data Types 

Documents are user objects, and collections are collections of users.

Document

  • Contains fields that map to values.
  • The maximum size of a document is 1 MB.

Collection

  • Document container.

 

Sunvera Software develops next-level software applications from start-to-finish. Schedule a free 30-minute call with us to discuss your business, or you can give us a call at (949) 284-6300.