Not sure how to approach this problem. Would greatly appreciate if some one can tell me if this is doable and if yes , how.
I have a collection in Mongo and every document in that collection has a field called Rank. When the user clicks a button, I have access to the req.user( with some custom fields) because I am using passport for authentication(both OAUTH and local).
Here is what I am looking for.
On the next page after the button click, I want to display 20 individuals who are ranked above the req.user rank. So assume I am the req.user and my rank is 24, I want all records having rank from 4 to 23 sorted from 4 to 23. Is this doable? Please guide.
This is how a single document in my collection looks like and the Rank field is somewhere in the middle
{
"_id" : ObjectId("5ed3c6c2776524724f2fae63"),
"Player_Name" : "Abhimanyu Sen",
"Player_ID" : "P0001",
"Player_ActivePlayer" : "N",
"Edition_1_Rank" : "0",
"Edition_2_Rank" : "0",
"Edition_3_Rank" : "67",
"Edition_4_Rank" : "113",
"Edition_5_Rank" : "185",
"Player_Owner" : "N",
"Edition5_TeamOwner" : "N",
"Edition6_TeamOwner" : "N",
"Edition1_Performance" : "Did Not Play",
"Edition2_Performance" : "Did Not Play",
"Edition3_Performance" : "Round of 32 - Challengers Cup",
"Edition4_Performance" : "Did Not Play",
"Edition5_Performance" : "Did Not Play",
"Total_Tournament_Matches_Played" : 8,
"Total_Tournament_Matches_Won" : 0,
"Total_Tournament_Matches_Lost" : 8,
"Total_Tournament_Matches_Points" : 3.0,
"Total_Challenge_Matches_Played" : 0,
"Total_Challenge_Matches_Won" : 0,
"Total_Challenge_Matches_Lost" : 0,
"Total_Challenge_Matches_Points" : 0.0,
"Total_Matches_Played" : 8,
"Total_Matches_Won" : 0,
"Total_Matches_Lost" : 8,
"Total_Points" : 3.0,
"Total_Games_Won" : 0,
"Winning_Percentage" : 0.0,
"Player_FDR" : 0.0,
"Rank" : 185,
"Player_ELORating" : "",
"Player_IsHeavyTraveller" : "",
"Player_NickName" : "",
"Player_ImageURL" : "",
"Player_CompanyName" : "",
"Player_Designation" : "",
"Player_DateOfBirth" : "",
"Player_TelephoneNumber" : "",
"Player_Website" : "",
"Player_LinkedinProfile" : "",
"Player_FBLink" : "",
"Player_InstagramLink" : "",
"Player_TwitterLink" : "",
"Player_Interests" : "",
"Player_Blog" : "",
"Player_Posts" : "",
"Player_Messages" : "",
"Total_Games_Lost" : 24,
"Total_Weighted_Points" : 2.65
}