Store #counts in document or retrieve in them from a count publication?


#1

Hi, i want to implement user follow/followers, and things like # of stuff they liked etc…

My schema for implementing that is using a relationship collection, for ex for following i have

{
     _id: id;
    follower: id;
    followee: id;
}

I want to show the number of each of those things on a user profile page.

Right now i use publish-counts package (https://github.com/percolatestudio/publish-counts) to retrieve the count of each of these things about a user , and they are update in realtime.

Is it better if i have a follower/followee count for each of the fields in the user document, and when a user follow another user, it performs a $inc on on the followers/followees field?

The pros of what i have now is that it only performs one update, while the second performs three (insert, update x2). The second method will obv have better read speed.

Whats your opinion?