In Firebase, there is a tree that holds data using parents, elements, and childs. Like so:
m3r945ba1lh
-JTHUY9SMruiPaKW6-SW
calendar: "2014-08-14"
name: "apple"
-JTHWE66v3E7NTuUidfM
calendar: ""
name: "hello"
text: "10101"
-JTHWFAYBxIZjOixh8ZZ
calendar: ""
name: "sos"
text: "111"
I need to delete the data that is slanted, but one bolded data set at a time.
I have tried using myDataRef.remove();
but it deletes ALL data stored.
I have also tried $(this).parent().remove();
but it doesn't work at all
anybody know how to delete one at a time?
Query the root and remove the children by iterating through them.
var rootRef = new FireBase('https://your-url.firebase.com/');
rootRef.once('value', function(snapshot){
var children = snapshot.val();
for(var child_id in children) {
// Create a reference to it
var child = rootRef.child(child_id);
child.remove();
}
});