M.Waqas Pervez
M.Waqas Pervez

Reputation: 2430

retrieving data from a multiple query seach in firebase

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!

Upvotes: 0

Views: 707

Answers (1)

Vladimir Jovanović
Vladimir Jovanović

Reputation: 2267

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?

Upvotes: 1

Related Questions