即使正确使用.indexOn,Firebase也没有定义索引

时间:2015-05-28 10:39:32

标签: firebase

我尝试使用Firebase(2.2.5)API / .orderByChild('得分')操作,我一直在

No index defined for score

虽然Firebase的文档说明我在使用WebSocket API时不需要为得分创建索引,但我确实创建了它。标记:

规则

{
"rules": {
    ".read": false,
    ".write": false,

    /* index players by score */
    "Players": {
      ".read": true,
      ".indexOn": "score",
      "$playerID": {
        ".write": "!data.exists() || data.child('uid').val() === auth.uid"
      }
    }
  }
}

数据

{
    "Players": {

      "-JpqOuoaHmcA2EngEvSZ" : {
        ".priority" : 0.0,
        "avatar" : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRS9Yh2lWzGP1oojIwNVV2JQUZYFX4_4pxvaADz8TfDF_WGrHbs",
        "draw" : 9,
        "lastTimeAccessed" : 1432705280027,
        "lost" : 7,
        "name" : "Hans",
        "score" : 126,
        "won" : 36
      },

      "-JpzVTpXZUZG-V0qJCDT" : {
        ".priority" : 2.0,
        "avatar" : "http://static.wixstatic.com/media/6a9a03_f979928a006c4d2ebc179c1c627dc119.png_srz_300_300_75_22_0.50_1.20_0.00_png_srz",
        "draw" : 0,
        "lastTimeAccessed" : 1432705280532,
        "lost" : 25,
        "name" : "Safari",
        "score" : 9,
        "won" : 3
      }
    }
}

调用

我有一个指向http://theapp.firebaseio.com/Players的Firebase()对象,我称之为orderByChild('score')。我希望这会奏效。

期待一些新的观点或提示。

0 个答案:

没有答案