I wan to delete multiple children with known key. I searched all the related posts but it doesn't seem to work. It shows red bracket.
Below is my code which i refer from other posts:
var updates = { }
for(i in removedProductVariationIdList){
updates["user/$i"] = null
}
Screenshot:
Firebase Structure (I want to remove 3, 4 under Product_Variation for example, which i know the key) :
CodePudding user response:
Java doesn't support template literals with the $i notation in regular strings, as far as I know. The simplest way to build a map with the null values:
Map<String, Object> updates = new HashMap<>();
for(i in removedProductVariationIdList){
updates.put("user" i, null);
}
Also see:



