im really new in coding so my question might be very easy. On image below you can see what i have in Firebase.
Here's what i have in my Firebase
In Framer im using this module and after writing this code:
response = (names) ->
print names
firebase.get("/test/items",response,{orderBy: "$key"})
im getting something like this:
{-L8S1RLTU3P3Lb-PxtsF:{amount:24926, date:"25.3.2018", type:"c"}, -L8S1RTNNySP0quUICNt:{amount:23616, date:"25.3.2018", type:"c"}, -L8S1RYPmG8L_EkYV8Vd:{amount:37863, date:"25.3.2018", type:"b"}}
the problem is that i want to get only amount. When im trying to change $key to amount it gives me an error:
{error:"Index not defined, add ".indexOn": "amount", for path "/test/items", to the rules"}
I have a feeling that solution is very simple but i can't find it :(
Fields are not automatically indexed. Since you're trying to filter items
by a field amount
, you must define an index on that field. Following the documentation on defining indexes, it should look something like:
{
"rules": {
"test": {
"items": {
".indexOn": ["amount"]
}
}
}
}