I’ve just answered an interesting question on Stack Overflow that we can summarized as follows:
docs
.userGroups
collection.As an example, let’s imagine we have two users groups, group1
and group2
and three documents doc1
, doc2
and doc3
. doc1
and doc3
can only be read by users of group2
, and doc2
can only be read by users of group1
.
So, how should…
In this article, I will demonstrate how you can quickly develop a web application that “OCRises” an image and translates the resulting text by mixing and matching different Firebase and Google Cloud services: Cloud Functions, Firebase Extensions and Vision API.
Also, I will show how the core business logic of such an app can be implemented in no more that 25 lines of code!
Not only will I share those 25 lines of code 😃 , but I am going to share the full source code of the web app shown below!
As illustrated in the above screenshots, the Travel…
Quite often in a application you need to aggregate data and order the results of this aggregation.
For example, let’s imagine a Restaurant Reviews App where you want to display the Top 3 restaurants in terms of number of reviews.
In the SQL world, this is quite easy to accomplish. For example, for the following two tables:
TL;DR: In this article we share and explain the code for building a module which allows Firebase end-users with a specific Admin role creating other users and assigning them other specific user roles. This solution can be applied to Web, Android, iOS and Flutter apps built with Firebase.
Most applications need to implement a role-based access control system.
Role-based access control is a method of restricting (and granting) application access based on assigned user permissions, which differ according to the user’s role.
Firebase offers all the necessary “mechanisms” to implement such a system.
On one hand we have Firebase Authentication…
With Cloud Firestore, we can combine multiple where()
methods to create logical AND
queries. These queries are called compound queries in the documentation.
However, as indicated in the documentation (Section “Query Limitations”):
Cloud Firestore does not support the following types of queries:
- …
- LogicalOR
queries. In this case, you should create a separate query for eachOR
condition and merge the query results in your app.
- …
Firstly, let’s create a set of example data. Like the example in the documentation, we are going to create some Firestore records for a set of cities.
As detailed in the Cloud Firestore documentation, data in Firestore is stored into documents, which are “organized into collections”. Documents can contain subcollections which, in turn, can contains documents.
The documentation also indicates that:
Documents in subcollections can contain subcollections as well, allowing you to further nest data. You can nest data up to 100 levels deep.
Normally, as a Firestore database architect, while working out your data model, you decide the ids of the different subcollections of a document.
For example, for a Restaurants Reviews application, you may decide to have a reviews
subcollection for each restaurant
document¹.
And…
Google Developer Expert for Firebase // Full-Stack Web Application Dev & Project Manager // Vue.js, SPA and PWA aficionado // Freelance Consultant