Firebase和REST - 使用unix时间戳按范围查询数据

时间:2016-11-15 13:03:38

标签: firebase firebase-realtime-database

我的数据看起来像这样:

development-
    minute-
       USD-
          1479185820-
             {"foo":"bar","unix_ts":1479185820}
          1479186000-
             {"foo":"bar","unix_ts":1479186000}

我想查询范围,但如果结果则返回全部。另外我怎么做订单?

curl 'https://dude-3fdc.firebaseio.com/development/minute/AUD_USD.json?auth=adfadf3M3d9Za&orderBy="development/minute/USD/unix_ts"&startAt=1479229020&endAt=1479229080'

{
  "error" : "Index not defined, add \".indexOn\": \"development/minute/USD/unix_ts\", for path \"/development/minute/USD\", to the rules"

根据文档,我想我必须使用索引。以下是我的默认规则。我怎么做索引?对于基于休息的查询,文档非常糟糕。

    {
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null",
    "development":{
      "minute":{
        "USD":{
      ".indexOn": ["unix_ts"]
        }
      }
    }
  }
}

或者因为它变得清晰火山底座不适合时间序列数据。因此回到mysql。

0 个答案:

没有答案
相关问题