Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase query containing value

I am trying to query data on firebase to find a child with a value containing a portion of a string. So say the value is 'apple' if I search 'app' I would have that record returned. I realize this has been asked but the answers I have read all point to the fact that firebase will be integrating this feature....its almost 3 years later and I can't seem to find anything.

like image 758
Sean Cook Avatar asked Mar 08 '26 12:03

Sean Cook


1 Answers

In your example...

If you are strictly querying for data that starts with a string, 'app' in this case, then that's easily done with:

queryStartingAtValue("app").queryEndingAtValue("app\u{f8ff}")

For more info, see the very well written but now legacy Firebase Guide To Retrieving Data

and scroll down to the Range Queries section

For completeness:

The f8ff character used in the query above is a very high code point in the Unicode range. Because it is after most regular characters in Unicode, the query matches all values that start with a b. (app in this case)

like image 143
Jay Avatar answered Mar 10 '26 03:03

Jay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!