0

I have just started to use firebase in my android project and the problem i am facing that i want to retrieve data from firebase based on a multiple query search.

 Query query = firebase.orderByChild("sender").equalTo(senderEmail);

and i want something like

Query query = firebase.orderByChild("sender").equalTo(senderEmail).orderByChild("reciever").equalTo(receiverEmail");

but it throws an exception that you can not use multiple orderByChild in a single query. Any help will be highly appreciated. If this question has been asked before please refer me to the link

Thanks!

M.Waqas Pervez
  • 2,492
  • 2
  • 19
  • 33

1 Answers1

1

Firebase doesn't support ordering by multiple queries.

Queries can only order by one key at a time. Calling orderByChild() multiple times on the same query throws an error.

More here.

But real question is why are you doing ordering if you want just one element?

Vladimir Jovanović
  • 2,261
  • 2
  • 24
  • 43