所以我有
let dbREF = db
.collection("Users")
.doc("mQ4lxHU1sQhKlSmYYkik5F4dapz1")
.collection("listings");
我有
dbREF
.where("state", "==", uState)
.get()
.then((querySnapshot) => {
并且我基本上从集合 dbREF 中获取多个文档,这些文档与 .where state === uState 相匹配。我想弄清楚的是如何搜索两个查询。
我试过这样做
dbREF
.where("state", "==", uState && "make", "==", selectedMake)
.get()
.then((querySnapshot) => {
但这没有用。我不仅要寻找具有 uState 值的状态,还要寻找具有 selectedMake 值的 make。我想知道是否有人可以指出我如何做到这一点的正确方向。非常感谢=]
您可以where
多次调用,条件将被合并在一起。所以:
dbREF
.where("state", "==", uState)
.where("make", "==", selectedMake)
.get()
另请参阅有关复合查询的 Firebase 文档部分。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句