Firebase Can't call equalTo() and startAt() combined [duplicate]

谁说胖子不能爱 提交于 2019-12-31 04:03:29

问题


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

My database is as follows

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

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

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

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

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

Thanks in advance.


回答1:


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.



来源:https://stackoverflow.com/questions/42413168/firebase-cant-call-equalto-and-startat-combined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!