
,I'm creating a social media app using react Native I'm wondering what would be the best approach to store things like "like" and "follow" ? I heard that it's better to be on its own collection but is it really? also, thought about stroing basic things like doing that and also adding an attribute on the posts collection called "likesCount" whick reflects the count only, an Int, and keep the likes on its own collection, so that for time line view it will only get a count, not do another db request to get the likes collection, what do you guys think?

For count, I think it's better to have the number in an attribute since it's never a good idea counting everything unless it's a small number

Respect likes in a collection, It's a good idea since that way you can query them

So you don't get all likes a post has, for example, you only get the ones from your friends or from your account to check if you liked it or not

Or just paginate tem

so you reckon, this approach is good? the posts are 5k+ and of course will grow, and I'm also using tanstack query to use some caching and get things to make sense, especially that I have a twitter-like "explore" where it basically gets 40 posts, doing infinite scrolling etc, so it's not from a specific friend or smth, so this neads to be heavily optimized for performance
Recommended threads
- Stuck in "deleting"
my parent element have relationship that doesnt exist and its stuck in "deleting", i cant delete it gives me error: Collection with the requested ID could not b...
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
- Database Double Requesting Error.
I am getting error for creating new document in an collection with new ID.unique() then too getting error of existing document. When button is pressed one docum...
