This may be a pretty simple answer but it really depends on how you structure your data.
If there are exactly 100 users at all times and you want everyone from position 65 to position 1, thats easy.
Likewise if you want what position user XYZ is, that's also easy.
There's also ways to load the top 2 users by position (or 35)
users:
user_id_0
position: 15
user_id_1
position: 32
user_id_2
position: 7
then to a query on the /users/position sort by position and then queryLimitedToFirst(2) will return user_id_2 and user_id_0.
Edit:
Based on more data, here are a couple more options. Given we have 5 users, each with a score (I noted their 'position' in the list)
uid_0: 50 //pos 2
uid_1: 25 //pos 1
uid_2: 73 //pos 4
uid_3: 10 //pos 0
uid_4: 58 //pos 3
If you want to know the position, based on score of uid_2 - I don't know your platform so I will give a generic flow:
step 1) query uid_2 to get his score, 73, then
step 2) queryOrderedByChild(score).startingAtValue(73), get nodes with scores from 73 to whatever the highest score is
step 3) then the result will be in a snapshot, so check snapshot.childrenCount, which will be the position if uid_2, which is 4. This will reduce the number of nodes loaded.
The downside is that the farther down the list, the more data would be loaded. If you only have 1000 nodes with just scores in them, that's not a lot of data.
The following solution avoids lots of data but requires more work by the app.
Of course, if your platform support array's this is a super simple task. Using the same structure above, load the children into and array and get the index number of the uid you want to know the position of.
Swift code
let ref = self.myRootRef.childByAppendingPath("scores")
ref.queryOrderedByValue().observeEventType(.Value, withBlock: { snapshot in
var myArray = [String]()
for child in snapshot.children {
let key = child.key as String
myArray.append(key)
}
let pos = myArray.indexOf("uid_0")
print("postion = \(pos!)")
})