Firebase rules provide predefined variables that can be used inside a rule definition:
Name | Definition / Usage |
auth | It represents information of the authenticated user. It will be null for an unauthenticated user. It is an object that contains uid, token, and provider fields and corresponding values. |
$ variables | It represents wildcard path to refer to the dynamically generated keys and represent IDs. |
root | It represents data snapshot at the root path in the Firebase database before applying the given database operation. |
data | It represents the Data Snapshot before applying the given database operation. For example, in case of the update or write, the root represents the original data snapshot without the changes in the update or write. |
newData | It represents the Data Snapshot before applying the given database operation. However, it... |