April 2018
Intermediate to advanced
284 pages
6h 43m
English
As seen in the preceding example, rules can't be used as filters. However, at times, we need to give access to only subsets of data based on some conditions or query parameters. For example, let's say that we need to return only the first 100 records out of 1000 records from the query result set. We can achieve this through the use of the query. expressions to give read and write access to your result set based on the query parameters:
tickets: { ".read": "query.limitToFirst <= 100"}
The preceding will give access to the first 100 records that are ordered by key by default. If you want to specify orderByChild, you can also do that, as follows:
tickets: { ".read": "query.orderByChild == 'department' && query.limitToFirst ...