Android Question Firebase rules and orderBy

dibesw

Active Member
Licensed User
Longtime User
This is my Firebase database:



My request is:

https://aaabbbccc.firebaseio.com/Allergeni.json?print=pretty

and result is:

[ {
"nome" : "Frumento"
}, {
"nome" : "Latte"
}, {
"nome" : "Solanacee"
}, {
"nome" : "Polifosfati"
}, {
"nome" : "Carne bovina"
}, {
"nome" : "Carne suina"
}, {
"nome" : "Uova"
}, {
"nome" : "Zucchero"
} ]

Now I wish to order by nome
My rules is:

{
"rules": {
"Allergeni": {
".read": "auth != true",
".write": "auth != true",
".indexOn": ["nome"]
}
}
}

and the request is:

https://aaabbbccc.firebaseio.com/Allergeni.json?orderBy="nome"&print=pretty

but the result is then same...

[ {
"nome" : "Frumento"
}, {
"nome" : "Latte"
}, {
"nome" : "Solanacee"
}, {
"nome" : "Polifosfati"
}, {
"nome" : "Carne bovina"
}, {
"nome" : "Carne suina"
}, {
"nome" : "Uova"
}, {
"nome" : "Zucchero"
} ]

I have read Firebase support and I have done a lot of tests;
i tried
".indexOn": [".value"]
orderByValue, orderByKey...but nothing

Also this dont works:

"rules": {
"Allergene": {
"nome" : {
".indexOn": ".value"},
".read": "auth != true",
".write": "auth != true"
},

can someone help me?
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…