Posts

Showing posts with the label Trigger Functions

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...