I'm using Google App Engine's datastore and looking for a design solution for "like" functionality for user's status (similair to Facebook "likes")
I've gone through the Sharding Counters concepts (https://developers.google.com/appengine/articles/sharding_counters) and found its good and suitable for counting number of likes where you can increment or decrement the count. But I want to store the userId who liked the status. So I tried the same sharding concepts to store userIds but facing the below issues, * First of all is it good to shard userId list like count? * If so when the user dislike it, I have remove the user id from shared list. To achieve this I need to traverse all the sharded datastore and do a userId check and remove
Any suggestions on this or alternative solutions to achieve it?
Sharding doesnt apply for that case. Sharding is to avoid many writes to the same object in short time periods. Makes sense for a 'likes' counter since many people like the same post. Not the same when sgoring who liked what. Those objects only change per-user, many users dont share the same object. Just store those in a non sharded table like you would in sql.