Reputation: 11
I'm using Firebase Realtime Database, and querying a child node from a HTTPS-triggered cloud function. Is there a way to save the path of that node?
We cannot use wild-card path in this function - are there any available functions I can use, or any other solution that will help?
Firebase Realtime Database structure looks like:
colleges:
clg1:
departments:
dep1:
students:
stu1:
name:
phone:
stu2:
name:
phone:
dep2:
students:
stu3:
name:
phone:
clg2:
departments:
dep3:
students:
stu4:
name:
phone:
stu5:
name:
phone:
dep4:
students:
stu6:
name:
phone:
Here, I want to update phone of specific student; how should I do it, given that we cannot make use of wildcard path in https cloud function?
Upvotes: 1
Views: 58
Reputation: 1758
You can access and save values to students:
set:
admin.database().ref(`departments/${dptid}/students/${sudentid}`).set({data:1})
update:
admin.database().ref(`departments/${dptid}/students/${sudentid}`).update({data:1})
Upvotes: 0