How to set item in list from separate data variable?

I am trying to create a list of notifications with the profile pics of the users who sent user a message. The profile pic is bot in the collection “notifications” in firebase, but in the collection “users”. How can I get the profile pic into a repeater list from the other collection?

The first thing that comes to mind, is when the notification is created in your database, you can also store the image of the message sender.

Some deails. Because firebase is a nosql database, you can (sometimes should) store data more than one times. Thats because if you dont use the way i explained above, the other way, is to make a rest call in your front end and get all the profile images you need. But as you can understand, thats not efficient in many ways such as computational power usage as well as cost (in firebase you pay by rest calls)

I hope you get the idea

there must be a way to use a formula to create a third list from the list of comments (data variable) and the list of users limited to the users who’s id is in the comments. That is pretty much how it is done in native code, using firebase ref.

yeah, that can be done by filtering your request you make in firebase, but again, if you take a look in firebase docs, it states as i told you, that firebase is a nosql database and you can have duplicated data.

that way, is way more complicated than it needs to be in my opinion but you can try it out.

What I am trying to do is industry standard. Say, for example, I write the user’s name and avatar to a comment. The next day the user changes their name and avatar. They see it does not update on their former comments. It creates a bad user-experience. They think the app does not work. I know there are functions I could write to make firebase admin sdk update a user’s avatar everywhere it may be different every time they change it. This would be extensive batch operations and is not an efficient way to use cloud functions.

Actually, i get what you say, and thats exactly how it should work, the idea behind the nosql database and the data duplication, is that you make the most frequent functions work easier and cheaper with less reads (by duplicating the data) that means the more infrequent functions (change profile image), become more complicated (by changing the prof image from one or two places)

But also in your case especially, you shouldn’t be that worried, because you need the image for notifications, (that wont exist for long)

Lastly, im not an expert by any means, i have just spent much time in firebase docs and YouTube tutorials. What i propose is what i would do based on my knowledge.

I will try to find the video that explains that, and add it bellow

especially 4:55