Firebase - 从 child x 获取数据到 child y

Firebase - get data from child x to child y

我没有找到从 child x 到 child y 获取数据的方法。

例如:

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

获取 child2 到 child3 之间的数据。

我知道我可以得到所有的前三个children,然后去掉第一个child。

但是如果我需要 child100 到 child101 之间的数据怎么办?

这是用于检索数据的 Firebase 文档:

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

我在上面的文档中没有看到我需要的东西。

他通过获取所有数据并删除您不需要的数据来做到这一点:

Infinite scroll with AngularJs and Firebase

感谢任何帮助!

Firebase 支持几种不同的 queries,包括 startAt()endAt(),应该可以满足您的需要。

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.
});