ostafen/clover

How could I get Top 10

ElecTwix opened this issue · 2 comments

Hey, I'm new with NoSQL I'm really excited about it but I couldn't find a way to sort out the just top 10
I could make it with complex functions but I was just wondering is there is an easy way.

Type of Collation in down below, I just want to get a max of 10 playtimes.
is there any query for that?

Userid   string `clover:"userid"`
PlayTime int    `clover:"playtime"`
Name     string `clover:"name"`

Hi, @ElecTwix. Try something like:

db.Query("myCollection").Sort().Limit(10)

That's worked and helped me understand thanks.