【发布时间】:2018-04-09 08:12:06
【问题描述】:
Firestore documentation on making queries 包含一些示例,您可以根据文档中的某些字段是否匹配、小于或大于您传入的某个值来过滤文档集合。例如:
db.collection("cities").whereField("population", isLessThan: 100000)
这将返回“人口”小于 100000 的每个“城市”。这种类型的查询也可以在 String 类型的字段上进行。
db.collection("cities").whereField("name", isGreaterThanOrEqualTo: "San Francisco")
我没有看到执行子字符串搜索的方法。例如,这是不可用的:
db.collection("cities").whereField("name", beginsWith: "San")
我想我可以自己使用 greaterThan 和 lessThan 添加类似的内容,但我想先检查一下:
- 为什么不存在此功能?
我担心它不存在,因为性能会很糟糕。
【问题讨论】:
标签: swift firebase google-cloud-firestore