上QQ阅读APP看书,第一时间看更新
Default variables
With the ability to create custom variables, Firebase has predefined variables that can be used in database rules in many use cases. The following is a list of predefined variables:
auth: This variable contains all the authentication related data, including UID and provider information. A null value in auth variable indicates that a user is not-authenticated.
- now: This variable has the current timestamp in milliseconds elapsed from a few decades (January 1, 1970).
data: This is the reference of current data associated with a read or write request. Data supplies a RuleDataSnapshot instance for different methods to find the data content.
- newData: When a write request is approved it creates a RuleDataSnapshot instance to write.
- root: This denotes RuleDataSnapshot of the tree from the current database tree.