Monday 5 June 2017

Cloud functions for firebase - remove value

I want to delete a specific child in my database using a cloud function. Basic function setup is ok, so I´ll only include the ref part. In this case I just want to remove the Pineapple from the "fruits".

My fruit with the FRUITID "Pineapple" is a child of "fruits" and has different child values. Besides, there are also different fruits under "fruits":

let fruitID = "Pineapple";
let ref = admin.database().ref("data").child("fruits").child(fruitID);
//ref.removeVal(); -> Which code to use?

Thanks!



via ktm125

No comments:

Post a Comment