-1

I didn't find a way to get the data from child x to child y.

for example:

parent:
    child1: {...}
    child2: {...}
    child3: {...}
    child4: {...}

get data between child2 to child3.

I know I can get all the first three children, and then remove the first child.

But what if I need the data between child100 to child 101?

This is firebase documentation for retrieving data:

https://www.firebase.com/docs/web/guide/retrieving-data.html

I didn't see something like what I need in the documentation above.

He did it by getting all the data and remove the data you don't want:

Infinite scroll with AngularJs and Firebase

Any help appreciated!

Community
  • 1
  • 1
Alon Shmiel
  • 6,753
  • 23
  • 90
  • 138

1 Answers1

1

Firebase has support for several different queries, including startAt() and endAt(), which should suit your needs.

var parentRef = new Firebase("https://<YOUR-FIREBASE>/parent");

parentRef.orderByKey().startAt("child100").endAt("child101").on("child_added", function(snapshot) {
  // This will be called each time for child100, child101, and any nodes between them.
});
Anid Monsur
  • 4,538
  • 1
  • 17
  • 24