Skip to Content
Serverless Web Applications with React and Firebase
book

Serverless Web Applications with React and Firebase

by Mayur Tanna, Harmeet Singh
April 2018
Intermediate to advanced content levelIntermediate to advanced
284 pages
6h 43m
English
Packt Publishing
Content preview from Serverless Web Applications with React and Firebase

Query-based rules

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Web Applications with Firebase

Building Web Applications with Firebase

Gareth Brown
React Native in Action

React Native in Action

nader dabit, Nickie Buckner

Publisher Resources

ISBN: 9781788477413Supplemental Content