Firebase did not specify an index even when using .indexOn correctly
I tried to work with Firebase (2.2.5) API / .orderByChild ('score') operation and I keep getting
No index defined for score
Although the Firebase states documentation I do not need to create an index to evaluate when using the WebSocket API, I created one. Markup:
rules
{
"rules": {
".read": false,
".write": false,
/* index players by score */
"Players": {
".read": true,
".indexOn": "score",
"$playerID": {
".write": "!data.exists() || data.child('uid').val() === auth.uid"
}
}
}
}
Data
{
"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
}
}
}
Call
I have a Firebase () object pointed to by http://theapp.firebaseio.com/Players , on which I call orderByChild ('score'). I would have expected this to work.
We look forward to fresh views or tips.
+3
source to share
No one has answered this question yet
Check out similar questions: