You can take in the wishlist
object and loop through each key, value pair and find the value that matches, using the key. Then you can just remove it using the key you found.
//---use firebase code to get the wishlistObj---, for now I'll use another value
var wishlistObj = {"key1": "value1", "key2": "value2", "key3": "value3"};
var keysArray = Object.keys(wishlistObj);
for (var i = 0; i < keysArray.length; i++) {
var key = keysArray[i];
var value = wishlistObj[key];
if (value === "value3") {
//You know that the "key" variable is the value of the key of that value you know
//Now you can use that key to take the value out of the firebase database
//Try
objectReference.child(key).removeValue() //Where the objectReference variable is the reference to the wishlist object in your database
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…