Firebase数据库orderByChild()。startAt()。endAt()无法按预期运行

时间:2019-04-16 17:25:02

标签: javascript firebase firebase-realtime-database

这是我的数据结构,

{
  "-LbrCWf6yUe1nr5iIn9O": {
    "mKey": "-LbrCWf6yUe1nr5iIn9O",
    "rank": 37477,
    "verified": true
  },
  "-LbrAMyMdwxSwwmEn_fn": {
    "mKey": "-LbrAMyMdwxSwwmEn_fn",
    "rank": 35482,
    "verified": true
  },
  "-LbqsgGcAMoh3YGkv1E5": {
    "mKey": "-LbqsgGcAMoh3YGkv1E5",
    "rank": 36484,
    "verified": true
  },
  "-LbrBXBdPMe-1Y_thyEs": {
    "mKey": "-LbrBXBdPMe-1Y_thyEs",
    "rank": 37493,
    "verified": true
  },
  "-Lbqqasv2t1R7jup1RSq": {
    "mKey": "-Lbqqasv2t1R7jup1RSq",
    "rank": 38500,
    "verified": true
  },
  "-LbqLO2eBnbRxHhHZb8X": {
    "mKey": "-LbqLO2eBnbRxHhHZb8X",
    "rank": 39501,
    "verified": true
  }
}

要求是获取属于特定 rank 范围的所有nodes,查询如下:

RankPredictor_Ref.orderByChild("rank").startAt(35000).endAt(37500);

在执行查询时,尽管有4个nodes落在了可能的范围内,但仍返回了零个nodes

我知道,我在这里丢失了一些东西。有人能帮我一下吗?谢谢!

0 个答案:

没有答案