Closed bcongdon closed 2 years ago
Yes! That's a good approach. If you don't want to write a backfilling script, you could query for the followers on every follow / unfollow, count them, and set followersCached
on the user.
I tend to like verbose names, but you might try followerCountCached
instead, so it doesn't sound like a list of followers. Also, I'm not sure you really need the Cached
postfix after all. So I'd go with just followerCount
.
It'd be nice to have a leaderboard with the top followed users. -- I'd be interested in working on this.
My understanding is that Firebase doesn't easily allow for aggregation queries (e.g.
SELECT user, COUNT(*) FROM follows GROUP BY user
), so this is nontrivial.One approach would be to:
followersCached
property to the User document (similar tocreatorVolumeCached
)followersCached
.Does this seem reasonable?
(See also https://manifold.markets/ScottLawrence/will-manifold-create-a-leaderboard)