My JSON Object:
"userLocation" : {
"10154053432889835" : { //UNIQUE USER ID
"latitude" : "27.7002088506885",
"longitude" : "85.3408864275271"
},
"10154053432889879" : {
"latitude" : "27.7002088506999",
"longitude" : "85.3408864275271"
},
"10154053432889456" : {
"latitude" : "27.7002088504585",
"longitude" : "85.3408864275271"
}
}
This represents location of various user of my app.
Requirement:
I want to message to all the user who are in certain distance from the current location of user.
For example: If user1's distance is 10Km from user2's location. Then user1 or user2 can message each other.
Problem:
I can download location of all users from userLocation node and compare to user's currentLocation and then message to each user if they met the distance criteria.
This solution is not viable for larger data set when there are say million users.
Question
Is there anyway to query the userLocation node so that I only get userLocation data of users who meet the distance criteria?