Finding the highest atomic counters

Hi,

Let’s say that whenever a user clicks a button I atomically increment a counter with key: “UserID”.
The update should be without delay, that is, without read before write.
After a week I want to see who is the user that clicked the highest number of times on that button.
Let’s say that there are 100 users and now I have 100 keys, each with a different number.
I don’t know the user’s IDs (there are only 100 out of a million).

What are my options ?
Can I use a view do convert it to a sorted list and query for the top 10 ?

Thanks

Yes, I would recommend you to write a view for that and emit it as the key. It then gets automatically sorted and you can limit() the number of rows that are returned to get your “top” ones.