I am getting the firebase warning "Using an unspecified index. Consider adding ".indexOn": "E-mail" at /user/544dceb6-98d-4f7e/clients.
The rule I added is:
{
"rules": {
"user": {
"$clients": {
".indexOn": ["E-mail"]
}
}
}
}
This is the call I'm making:
firebaseRef.child(authData.uid + "/clients").orderByChild("E-mail").equalTo(this.props.params.clientId).on('value', function(clientSnapshot) { ... }
This is how my data is structured:
database
+ user
+ 544dceb6-98d-4f7e...
+ clients
+ -K96sXIXRUIOK8....
+ E-mail
I suspect the issue has something to do with the two layers of keys but can't find a solution.
Many thanks!
You're missing a level in your rules.json:
{
"rules": {
"user": {
"$userid": {
"clients": {
".indexOn": ["E-mail"]
}
}
}
}
}
Side note: it is somewhat confusing that you have user
(singular) and clients
(plural) in the tree. Making them consistent helps in keeping your data structure easier to understand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With