You're viewing the legacy docs. They are deprecated as of May 18, 2016.
Go to current docs

“newData” Rule Variable

For .write and .validate rules, the newData variable gives you a RuleDataSnapshot corresponding to the data that will result if the write is allowed (it is a "merging" of the existing data plus the new data being written). So if you wanted to ensure that every user has a name and age, you could use:

  "rules": {
    "users": {
      "$user": {
        ".read": true,
        ".write": true,
        ".validate": "newData.hasChildren(['name', 'age'])"

Since newData merges existing data and new data, it behaves properly even for "partial" updates. For example:

var fredRef = new Firebase("");

// Valid since we have a name and age.
fredRef.set({ name: "Fred", age: 19 });

// Valid since we are updating the name but there's already an age.

// Invalid since the .validate rule will no longer be true.

The newData variable is not available in .read rules since there is no new data being written. You should just use data.