Reputation: 65920
@firebase/database: FIREBASE WARNING: Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "status" at /groups/test/leadPropertyInformations to your security rules for better performance.
Firebase RTD Rules
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"groups": {
".indexOn": ["leadPropertyInformations/status"]
}
}
}
JSON Tree
Note: You cannot see status
property. But it is there on the 3rd arrow path.
Query using AngularFire
getActiveLeadPropertyInformations(): Observable<LeadPropertyInformationModel[]> {
return this.angularFireDatabase
.list<LeadPropertyInformationModel>(
`groups/${this.groupId}/leadPropertyInformations`,
(ref) => ref.orderByChild('status').equalTo('active')
)
.valueChanges()
.pipe(first());
}
Can you tell me what was the issue with my Rule?
Upvotes: 1
Views: 1083
Reputation: 35659
The path is not correct (at least not as it's described in the question)
Your index is
leadPropertyInformations/status
and the path is actually
leadPropertyInformations/22611/status
Note the 22611 in the path - that means you'll need to add something to represent the child nodes like $an_id to reference the child nodes shown in the question.
Upvotes: 0
Reputation: 7398
You would need more placeholders in your rule to make i work:
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"groups": {
"$groupId": {
"leadPropertyInformations":{
".indexOn": ["status"]
}
}
}
}
}
Upvotes: 2