![](/img/trans.png)
[英]Two ajax requests on same event at same time . what should be the typical behaviour? how it is different if request is synchronous
[英]How to query in two different path with same request?
例如它是简单的调用:
const stateQueryRes = await citiesRef.where('state', '==', 'CA').get();
但我想得到“州”不在被禁州列表中的城市(来自单独的文件“bannedCitiesDoc”。这个“bannedCitiesDoc”是包含被禁城市数组的文件。例如:
const stateQueryRes = await citiesRef
.where('state', '==', 'CA')
.where('state', ‘not’-in, bannedCitiesDoc)
.get();
这个有可能?
Firestore 查询一次只能考虑单个集合中的文档。 不可能在多个 collections 之间进行类似 SQL 的“连接”,也不可能将文档字段的内容用作查询过滤器的输入。
如果您需要处理两个 collections 中的数据,则必须进行两次查询。 在您的情况下,您必须首先查询禁止城市,然后查询 state 中的城市,然后用第一个查询的结果过滤掉第二个查询的结果。 您将无法通过单个查询来完成此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.