或Firestore查询中的逻辑操作 [英] OR Logical operation in Firestore Query
本文介绍了或Firestore查询中的逻辑操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在firestore查询中应用OR操作,如:
Is there any way to apply OR operation in firestore queries like:
if(name ==Jhon|| lastname ==James){
然后执行此操作
}
if (name == "Jhon" || lastname == "James") { then do this }
推荐答案
目前看来Firestore不支持析取。
It currently seems that Firestore does not support disjunctions.
解决方法是合并查询结果 query.whereEqual(name,John)
和 query.whereEqual (姓詹姆斯)
。
Workaround would be to merge results of queries query.whereEqual(name, John)
and query.whereEqual(surname, James)
.
请记住,从结果中你必须删除重复的那些,在两种情况下评估为真的那些。
Keep in mind, that from the result you have to delete the duplicated ones, those which are evaluated as true in both conditions.
这篇关于或Firestore查询中的逻辑操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文