I am using GeoFire to store location in Firebase realtime database. I have 2 tables table-a
and table-b
. For both of these tables, I would like to enable indexing. On saving the below rules, Firebase prompts the following error:
Cannot have multiple default rules ('$table-a' and '$table-b').
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"$table-a": {
".indexOn":"g"
},
"$table-b": {
".indexOn":"g"
}
}
}
Any ideas on what I might be missing here?
I think you should do as follows:
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"table-a": {
".indexOn":"g"
},
"table-b": {
".indexOn":"g"
}
}
}
As explained here, the $location
syntax is "used to reference the key of a $location
that was used earlier in a rule structure"