Firebase无法组合调用equalTo()和startAt() [英] Firebase Can't call equalTo() and startAt() combined

查看:86
本文介绍了Firebase无法组合调用equalTo()和startAt()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要查询的Firebase数据库,但是在运行时出现错误,提示

I have a Firebase database that I'm trying to query, however I'm getting a error at run time saying

java.lang.IllegalArgumentException: Can't call equalTo() and startAt() combined

我的数据库如下

   //DB refrence
    myBikesDB = FirebaseDatabase.getInstance().getReference().child("Bikes  Registered By User").child(ronan);

    //query
    query = myBikesDB.orderByChild("beaconUUID").startAt("!").endAt("~").equalTo(true, "stolen");

因此,在查询im尝试返回值beaconUUID不为null的所有数据库对象的情况下,此位正常工作.

So with the query im attempting to return all DB object where the value beaconUUID is not null, this bit works correctly.

但是,一旦我添加了第二个条件.equalTo(true, "stolen"),我就会得到上述错误.

However, once I add a second criteria .equalTo(true, "stolen"), I get the above stated error.

有什么方法可以返回所有具有beaconUUID值且不为null且被盗设置为true的项目.

Is there any way I can return all items that have the value beaconUUID as not null AND have stolen set as true.

谢谢.

推荐答案

我认为您无法进行此查询.错误消息很清楚. 但是您可以做的是遍历所有响应项,并将那些具有被盗"属性的项过滤为true.

In my opinion you cannot make this query. The error message is pretty clear. But what you can do its to iterate throught all your response's items and filters thoses who have the attribute "stolen" to true.

这篇关于Firebase无法组合调用equalTo()和startAt()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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