问题
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