firebase query methods startAt() taking case sensitive parameters
Solution 1:
There is currently no support for lowercase searches in Firebase. The best way to handle this would be store the lowercase string along side the original string and then query the lowercase string instead.
var ref_restMenu = firebase.database().ref()
.child('Restaurants')
.child('Company')
.child('menu');
var item = "Apple Pie";
// Or however you store data
ref.push({
itemName: item,
itemNameLower: item.toLowerCase(),
...
})
Then you could query as so:
//Check if item is already exist!
// query itemNameLoweruse and .toLowerCase()
ref_restMenu.orderByChild("itemNameLower").startAt(itemName.toLowerCase()).once("value", function(snapshot) {
var data = snapshot.val();
if(data !== null) {
//We will ger item name and restaurant id from this data.
callback(data);
} else {
//Item not found in globalMenu
console.log("%c Item not found in Global Menu", "color: red");
}
});
This does require replicating the data, but as of now there is not an easier foreseeable option.
Reference: Firebase Google Forum