My User collection contains the following documents:
{"_id" : 1, point_count: "12"},
{"_id" : 2, point_count: "19"},
{"_id" : 3, point_count: "13"},
{"_id" : 4, point_count: "1233"},
{"_id" : 5, point_count: "1"},
... and about 1000 more
My question is: Is it possible to show ranking of each user based on point_count field when I search by id? let say I use this query to find user with id = 4
db.User.find({_id: 4})
let assume highest point_count in my entire collection is 1233, I'm hoping to get this result
{"_id" : 4, point_count: "1233", rank: 1}
rank 1 because 1233 is the highest point_count
or when I search user with id = 5, my expect result should be
{"_id" : 5, point_count: "1", rank: 1000..something}
1000..something because it is the lowest rank and there are around 1000+ id in the document. Thank you all so much for helping me here!