i attempting remove 1 specific node database querying , calling query.ref.removevalue()
though every time piece of code runs deletes entire child instead of node. code looks this...
let query = (ref?.child("groups").child("martins").child("messages").queryequaltovalue(selectedvalue)) query!.ref.removevalue()
my database looking this...
thanks help, appreciate it.
the query reference points location query defined on, not elements matches. query!.ref.removevalue()
remove entire location.
to remove individual items query matches, you'll need attach listener query , iterate on children:
let query = ref?.child("groups").child("martins").child("messages") .queryorderedbykey("item").queryequaltovalue(selectedvalue) query.observeeventtype(.childadded, withblock: { (snapshot) -> void in snapshot.ref.removevalue() })
Comments
Post a Comment