0

这是简单的结构:

$countryCode
 -autoid13
  -category: vehicles
 -autoid12
  -category: sport
 -autoid11
  -category: food
 -autoid10
  -category: sport
 -autoid9
  -category: vehicles
 -autoid8
  -category: food
 -autoid7
  -category: sport
 -autoid6
  -category: sport

我的问题是如何只获取具有类别的项目: id7-id11 项目之间的运动?/autoid 键由 firebase 管理

4

1 回答 1

0

这是怎么做的

countryCode
 -autoid13
  -category: vehicles_13
 -autoid12
  -category: sport_12
 -autoid11
  -category: food_11
 -autoid10
  -category: sport_10
 -autoid9
  -category: vehicles_09
 -autoid8
  -category: food_08
 -autoid7
  -category: sport_07
 -autoid6
  -category: sport_06

和伪代码

   ref.orderBy("category")
      .queryStartingAtValue("sport_07")
      .queryEndingAtValue("sport_11")

将返回

 -autoid7
  -category: sport_07
 -autoid10
  -category: sport_10
于 2017-03-01T17:48:35.477 回答