Posts

Showing posts from September, 2020

How to make Firebase query search not case sensitive #18

Image
How to make Firebase query search not case sensitive because you know Firebase provide exact match "==" with case sensitive. So we will solve this issue in the chapter in detail. We will use the Laravel PHP SDK for the firebase for all the queries stuff. Also we will see case insensitive sorting with Firebase orderBy using Firebase search ignoring case. Now lets consider a simple example, you have 'Student' list and you want to search by name. So the main use of any search is that, you insert one or two characters and the system should search the most matching one, but that not the case in Firebase. Firebase is a case sensitive. Means string "Name" and "name" are two different values for Firebase. All Firebase developers are facing this issue, which is most basic necessity. So lets first understand, currently what is provided by Firebase. See the below example of Student List. Now here you see, we have a Student ...

Chapter 22 - How to write trigger functions in Firebase Cloud Functions

Image
In this chapter, we will learn how to create a function that basically acts a MySQL triggers.We will learn in depth how the onCreate, OnUpdate, OnWrite, OnDelete methods of Firebase Cloud Functions works. So we will understand this by an example,  whenever a Student takes a exam for subject, increase the counter of "Exams" in Student. A cloud function keeps an watch on document mentioned and whenever any action (crud) takes places, you can write your piece of action. Now consider this the basic Student structure And a basic subject structure And you insert a data in Exam collection, whenever a student takes an exam of Subject with marks obtained. Now you update "totalexams" a counter field which shows total exams taken by student and a "totalmarks" fields which is summation of marks of all Exams took by that Student. So lets write a function onCreate for the Exam/{ExamID}. Before starting this, please read the basic installation and deploying funct...

Extend your Firebase Cloud Firestore Realtime Database with Cloud Functions #21

Image
Firebase Cloud Functions are not related to Laravel PHP code. You cannot code cloud functions in Laravel. Basically they are some code hosted in Firebase Console itself (Serverless). So you have to come out of your PHP stuff and code in Javascript. You have to see this as MySQL triggers. When you create, update, delete data in Cloud Firestore, you can write certain actions. For an example, whenever a Student takes a exam for subject, increase the counter of "Exams" in Student. So we need to understand Cloud Functions for our upcoming chapters, where we learn to make Full text search using Algolia or ElasticSearch and many stuffs like that. Lets get started You can find the Functions tab in the Sidebar of Cloud Functions. It will instruct you to install firebase tool in your pc. So before running this command in local PC, make sure you have installed Nodejs version 10 (at time of this chapter written, may change...