Próbuję jednocześnie usuwać dane z kilku lokalizacji z bazy danych Firebase.Używanie UpdateChildValues do usunięcia z Firebase
Firebase docs stan:
"The simplest way to delete data is to call removeValue on a reference to the location of that data. You can also delete by specifying nil as the value for another write operation such as setValue or updateChildValues. You can use this technique with updateChildValues to delete multiple children in a single API call."
Mój kod jest
let childUpdates = [path1 : nil,
path2 : nil,
path3 : nil,
path4 : nil]
ref.updateChildValues(childUpdates)
Wszystkie cztery ścieżki są struny, ale pojawia się błąd:
"Type of expression is ambiguous without more context."
bym przypuszczać to nastąpi ze względu na wartości zerowe, ponieważ jeśli zastąpię zero z czymkolwiek innym (takim jak Int), błąd znika.
Jaki jest poprawny sposób użycia updateChildValues do usunięcia danych z Firebase? Chcemy, aby działał on w podobny sposób do funkcji removeValue() w Firebase. Powodem, dla którego chcielibyśmy to zrobić, jest możliwość usunięcia z wielu miejsc w jednym wywołaniu.
oszczędzasz mój dzień –
Dziękuję bardzo! To zdecydowanie musi być w dokumentacji Firebase, więc frustrujące! – Crashalot