Deleting multiple values in Firebase at once

Hi everyone,
I understand that deleting values in Firebase is nothing else than updating them to “null” and that sounds simple enough. However, I would like to delete/update 30 values at the same time when a button gets clicked and instead of updating every single one of them, I would love to instead just say "delete all values that you can find under xyz.

For example:

I would like to “null” all 30 key/value pairs that are sitting underneath the user ID in the screenshot.
Is there a better/easier/faster way to achieve this rather than going like:
'1. In Realtime DB call Save Workout_Weight/userID/nick_abductionmachine value to null
'2. In Realtime DB call Save Workout_Weight/userID/nick_backextension value to null
'30. In Realtime DB call Save Workout_Weight/userID/… value to null

Thanks a lot,
Antje :slight_smile:

1 Like

You can set any level of the JSON tree to a null, erasing everything below it.


Also notice I used the CLOUD variable block instead of the RealtimeDB SAVE block. Just use the RealtimeDB KEY as the Variable name in the SET CLOULD block. Boom! No asynchronous issues! You can do the same for the GET block.

Happy Thunking!


Nice, thank you very much!
And thanks for the hint with regards to CLOUD variables. I saw it in the documentation but was hesitant and solved some asynchronous issues through functions. Sounds like it’s worth looking into though.

Thanks again!

No need to replace existing blocks, you can mix and match for a phased change

Hi there, I just started saving values using the Cloud variable now instead of the Realtime DB Save block and it works flawlessly.
I don’t find the documentation very helpful and am now a bit lost how to change my GET blocks accordingly, as you suggested using the Cloud variable can help with asynchronous issues that I have formerly seen with the Realtime DB GET block.
Can you maybe point me the right way?
Thank you,

1 Like

Let’s say you have a get block like this:

Keep the “key” parameter the same when you use the cloud variable block. Use the key value as the cloud variable name, just like you did when changing from the SAVE block.

There is no error block using cloud variables. Anything you have in the THEN DO section can be moved to after the Set block.

If you can share a specific example of just one GET block you are trying to convert, I can try to give more specific suggestions.


Perfect, thank you so much! Works great!

1 Like

This is very helpful, is there a way to quickly create multiple values, or multiple objects at once?

yes as @drted mentioned he did it to null instead of null put the value you want

No that doesn’t create multiple objects, just 1 object.

I’m wondering if there’s a way to create multiple objects at the same time.

Like the screenshot above should make this result below (I manually made this result for illustrative purposes, it doesn’t actually work this way currently)

Never mind, figured it out. I forgot how handy for each item j is…

Happy Thunking!

1 Like