[英]Uncaught Error in snapshot listener: FirebaseError: no matching index found
[英]“Error getting documents: FirebaseError: no matching index found.” — trying to use WHERE clause on two fields
我正在尝试在两个字段上使用 where 子句。 我很惊讶地发现我不能在两个不同的字段上使用不等式子句,但我已将子句更改为使用“in”,并尝试了以下操作:
await db.collection("Colours").where("beta", "in", [3, 4, 5, 6]).where("alpha, "!=", [])
.get()
...
并且不再得到不等式错误,但确实得到这个:
Error getting documents: FirebaseError: no matching index found.
有没有办法解决? 我真的很失望,我似乎无法使用两个 where 子句! 另一种方法是在客户端进行过滤,但这需要从第一个子句中读取所有内容,对吗? 我的数据有很多文档,它会导致大量 Firestore 读取,我试图避免这种情况。
有一个关于这个的 GitHub 问题。 见https://github.com/firebase/firebase-js-sdk/issues/5152
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.