包含值的Firebase查询 [英] Firebase query containing value

查看:96
本文介绍了包含值的Firebase查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在firebase上查询数据,找到一个包含一部分字符串的值。所以说如果我搜索应用程序的值是苹果我会有记录返回。我意识到这已被问,但我已阅读的答案都指出,firebase将集成此功能....近3年后,我似乎无法找到任何东西。

$ b $在你的例子中...



如果您严格查询以a开头的数据字符串,在这种情况下,应用程序,那么这很容易完成:

  queryStartingAtValue(app)。queryEndingAtValue(app \u {f8ff})

有关更多信息,请参阅写得很好, Firebase检索数据指南



然后向下滚动到范围查询部分

完整性:

lockquote

在上面的查询中使用的f8ff字符是Unicode范围中非常高的代码点
。因为它在
Unicode中的大多数常规字符之后,查询匹配所有以b开头的值。 (在这种情况下,应用程序)


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.

解决方案

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)

这篇关于包含值的Firebase查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆