Skip to content Skip to sidebar Skip to footer

Querying By Range In Firebase

I have a range slider for prices of food , and based on the min and max of the slider , I want to display the foods which are in this range. Slider code multiSlider.setOnThumbValue

Solution 1:

You're storing numeric values as strings in the database. Firebase sorts strings lexicographically. In lexicographical order of you have number from 1 to 12, they are sorted as "1", "10", "11", "12", "2", "3", "4", "5", "6", "7", "8", "9". So the range from "1" to "10" is precisely those two "numbers".

To solve this problem, store your numeric values as actual numbers in the database.

Also see:

Post a Comment for "Querying By Range In Firebase"