Recover firebase data with multiple parameters

5

I'm trying to recover a firebase node, but it needs to match two parameters, start date and end date. The node gets the way I was given an option would be to put another value for date_start_end: 1478484000_1478397600 , so it does not have to fetch between dates. That would not be a viable option.

I'vealsobeentryingtouseitsothefirebasedoesnotsupportmorethanoneorderBy

.orderByChild("date_start").startAt(mDay).endAt(mDay) .orderByChild("date_end").startAt(mDay).endAt(mDay);

This takes the error of

java.lang.IllegalArgumentException: You can't combine multiple orderBy calls!

Any suggestions for resolving this issue?

    
asked by anonymous 06.11.2016 / 14:54

1 answer

1

From Documentation :

  

You can only use one order-by-method at a time. Calling an order-by method multiple times in the same query throws an error.

So that's why you have an error.

There may be a problem with the way you structured this query, because you want to filter records that started between mDay and mDay and all ended mDay and mDay . What do you need? See all that started and ended the same day?

Would not it be better to search for records that started between one date and another and display the date they were finished? Or list all that ended between one date and another and list when they started?

Something like: .orderByChild("date_start").startAt(07112016).endAt(07122016); (I'm not sure how you're organizing this date)

    
07.11.2016 / 13:51