Reputation: 488
I wanted to delete a key, but I have not been capable of achieve it. I'm trying with:
ref.child("notifications").once("value", function(usersSnap) {
var i = 0
usersSnap.forEach(function(reciptsSnap) { //for every user
reciptsSnap.forEach(function(reciptSnap) {
reciptSnap.forEach(function(c) {
if (reciptSnap.key=="jkk....."){
console.log("removed date nad its parent"+reciptSnap.key+" "+c.val())
reciptSnap.key.remove() //did not work brings remove is not a function
}
Upvotes: 1
Views: 6167
Reputation: 363627
The reciptSnap
is a DataSnapshot
, which contains data from a Database location.
It cannot be removed directly.
You can use:
reciptSnap.ref.remove()
Upvotes: 3