0

E.g. I have next data in my Firebase Realtime Database (my json file contains json array of some objects):

enter image description here

I would like to get all objects starting from a specific index (position) to the end of this array (in Firebase DB json array is converted to simple object which contains children with keys 001, 002 and so on)

So I need something like this but for Firebase query:

list.subList(10, list.size)

I know there are limitToFirst, limitToLast methods but it's different

fireDatabaseReference.child("episodes").limitToLast(10)

It won't do what I need. Because I need to know the size of this array and I need to be sure that this array won't become bigger at the moment someone makes such request (at some point this array can get become bigger due to adding new objects)

Would be great to have a method like from to get all children from 10 to the end (so first 9 children are excluded):

fireDatabaseReference.child("episodes").from(10)

But there is no such method

Is there any solution for this?

user25
  • 2,873
  • 2
  • 30
  • 66

1 Answers1

0

Solved :)

fireDatabaseReference.child("episodes").orderByKey().startAt("10")
user25
  • 2,873
  • 2
  • 30
  • 66