I have a query:
const q = query(collection(db, 'users'), orderBy("highScore", "desc"));
Which returns all the users with all their highscores in descending order. The problem is that there are users who got the same high scores, and now they are ordered I think randomly. So for example, if 3 users get 3000 score it just randomly orders those 3. How can I for example look at another field(a timestamp) and order the last to achieve the 3000 pointsfirst and so on?
Advertisement
Answer
You can use orderBy again in order to sort them, try checking this:
const q = query(collection(db, 'users'), orderBy("highScore", "desc"), orderBy("timestamp", "desc"));
Or, you can do it client-side by sorting them.
You can check this.