Refresh Firebase Database Database Profile URL for All Posts
Hi my database structure for post feeds. Database structure
When I change the user's profile picture, I want to update all posts with the new image (under posts / postID / user / userID / image
If I have a ton of posts how to do it in the best way (automatically)
I am trying to execute a request and then update all keys, but the request does not work with node user id.
+3
source to share
1 answer
Maybe a better way.
Instead of duplicating all user data in every post, why not store the user details (including the pic profile) in a structure like
/users/userID/name /users/userID/profileURL
and then just store the posterID in the post
You will need to make two calls to the database to get the data, but if you update your profile picture once it will be restored correctly for all posts
+1
source to share