Reputation: 23
I would like doing request in Firebase with multiple query but too in child nodes.
Screen :
I would like create request to get "lat" and compare with 2 values.
For exemple :
SELECT * FROM users WHERE lat >= 1 && lat <= 2
First filter with "lat" and then, "lng".
How could I perform such a query on Firebase?
Upvotes: 0
Views: 1587
Reputation: 598708
You can only filter on a single property in a Firebase query. See http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase for more information on this.
Luckily somebody came up with a brilliant way to combine lat and lon values into a single value, called a geohash. And there is an open-source library called Geofire that builds on the Firebase Database SDK to allows, calculating, writing and querying such geohash values. I recommend that you check it out: https://github.com/firebase/geofire-objc
Upvotes: 2