Rule Variables

Rule Variables are variables which can be accessed by your Rule Expressions. These variables will always exist whenever a Rule Expressions is evaluated, however some variables (such as auth) may be null.

Expression variables

The following variables may be used within expressions:

  • auth - Auth data for the client.
  • data - A RulesDataSnapshot for the current data in Firebase at the location of this expression.
  • newdata - A RulesDataSnapshot for the new data being written to Firebase at the location of this expression.
  • root - A RulesDataSnapshot for the current data in Firebase at the root of your Firebase.
  • now - Current time in milliseconds since the unix epoch.
  • path - Can be used within a $foo Rules block to refer to the actual name of the child being read or written.