Accessing parent's key in firebase bolt

Viewed 38

We can access the current locations key using key(). I want to access the key of the parent(or some ancestor) of current location in the bolt file. So, is there something like this.parent().key()(this does not seem to work) for doing so?

Example: If I want to create the following in the rules json file:

....
"a":{
  "$x": {
    "$y":{
      ".validate": "data.isNumber() && y.length + x.length < data.val()"
    }
  }
}
....

The ".bolt" file would look like this:

....
"a":ABC[]
....
type ABC extends XYZ[] { }
type XYZ extends Number {
  validate() { key().length + ???.length < this }
}

So, what do I replace ??? in the file with? (should be something like this.parent().key())

0 Answers
Related