Hello everyone, I have a document in my collection that looks like this: { Player_Name: Sandeep Nair Player_TotalWeightedPoints: 80 Player_Rank: 23 }
I have around 200 similar documents in my collection. The Player_Rank is determined by the total Weighted points, sorted in descending order. The player with the highest weighted points has rank 1, and so on. I have 2 specific use cases:
- I need to show the player's rank when they log into the web application.
- I need to update the rank based on match scores every time a match occurs.
How can I calculate this Rank field in Mongo DB? Any insights would be greatly appreciated.