I have a problem. Below in the screenshot, you can see the structure of my database. I need to filter my query regarding two fields: subgroup and time.
I wrote the following code:
private fun readFromDatabase() {
ref?.orderByChild("time")
?.equalTo("12:00 - 13:30")
?.orderByChild("subgroup")
?.equalTo("first")
?.addValueEventListener(object: ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
if (snapshot.exists()) {
val list = ArrayList<Day>()
for (daySnapshot in snapshot.children) {
val day = daySnapshot.getValue(Day::class.java)
list.add(day!!)
}
adapter.submitList(list)
}
}
override fun onCancelled(error: DatabaseError) {
}
})
}
However, I got the error: java.lang.IllegalArgumentException: You can't combine multiple orderBy calls!
Is there any way how I could do it differently?
