或 Firestore 查询中的逻辑操作 [英] OR Logical operation in Firestore Query

查看:18
本文介绍了或 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(surname, James) 的结果.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆