Introducing Firebase 

Firebase is a set of tools with which to build scalable applications in the cloud. Among those tools, you'll find authentication, storage, databases, notifications, and hosting.

You can actually choose between two databases: the Firebase Realtime Database and Cloud Firestore. In this chapter, we'll be using the Cloud Firestore database, which is a NoSQL document database that simplifies storing, querying, and updating data in the cloud. More importantly in the context of this book, you can use it as the backend of your iOS and Android apps, with no need to write the code for a web service and, in many cases, without writing any code at all for your server-side service.

Relational databases use tables to store data, with a fixed schema that all records must follow. For example, if you store user data, you can create a users table with three fields: user_idname, and password. Each record in the table will follow the constraints (rules) you define when you design your table.

In relational databases, you store data in tables. The "columns" of the tables are called fields, and the "rows" of the table are called records. For example, if you store users, the table name might be Users, and the fields might be "Name" and "Surname". "John" - "Doe" and "Bill" - "Smith" are records.

A NoSQL database, on the other hand, is self-describing, so it does not require a schema. All its documents are JSON documents, and, theoretically, each document could have different fields and values (or key-value pairs). In the example we mentioned previously, in the users collection, the first user might have a user_id, name, and password, but the following could also contain a "user_role" field or a "user_age" field. Both documents would still be valid.

Another huge difference is the language used. SQL databases use Structured Query Language to define and manipulate data. This makes SQL databases easy to use and wide spread, but SQL requires you use predefined schemas to design the structure of your data.

In a NoSQL database, you have a dynamic schema and data is unstructured, and can be stored in many different ways.

Generally speaking, when you need to perform complex queries in multiple tables and you have structured data, SQL is the best option. When you don't need to perform queries that require several "JOINS" between tables and you want an easily scalable and fast solution, you would probably choose a NoSQL database.

As an added bonus, a backend created with Firebase can scale over Google server farms, so it's virtually limitless.

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

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