How can I save a list of data (objects) under a userID in Firebase?

Hello All,
I have been searching the forums but have not been able to find an answer.
I am trying to save to a firebase data base ( either RTDB or Cloud storage) a file and separate name for the file, attributed to a specific user, with the ability to save multiple files.
I have been able to save 1 file (the Name and the file I combined as an object) but if I try to save another, it replaces the initial save in the database.
Note… I may mention that the file I am trying to save ( and apparently did save) is a file that I was callling to upload from the users device. This seemed to work as it allows me to choose a file from the users device to save, and shows up in the data base.
ANY info or advice would be greatly appreciated!

1 Like

Hey @audiodocpro :wave:

Can you share a screenshot of the blocks you’re using to save the data? Usually data is stored under a uid and and document ID like this

mainUserBucket/[users uid]/files/fileType/[documentid]/[your data here]

Like this. An example from one of my own projects.

The documentid needs to be different to save multiple pieces of data under the users uid

2 Likes

The way Firebase works will overwrite any data stored under a specific key of you try to save to the same key.

You either use a kind of a list and items under this list will have an object containing the name and the file. whenever you want to add another file you need to add to the list otherwise it will overwrite the existing values.

3 Likes