arnoldssss arnoldssss - 4 years ago 122
Node.js Question

How to delete data in Firebase?

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

enter image description here

Answer Source

The reciptSnap is a DataSnapshot, which contains data from a Database location.
It cannot be removed directly.

You can use:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download