I went though the firebase docs for updating a value in realtime database using Cloud Functions for Firebase, but am not able to understand.
My database structure is
You are trying to call update() on a DeltaSnapshot object. There is no such method on that type of object.
var eventSnapshot = event.data;
eventSnapshot.update({
"isVerified": true
});
event.data
is a DeltaSnapshot. If you want to change the data at the location of the change represented by this object. Use its ref
property to get a hold of a Reference object:
var ref = event.data.ref;
ref.update({
"isVerified": true
});
Also, if you are reading or writing the database in a function, you should always return a Promise that indicates when the change is complete:
return ref.update({
"isVerified": true
});
I would recommend taking Frank's advice from the comments and study the existing sample code and documentation to better understand how Cloud Functions works.