title: Firebase security rules with wildcards
body: <p>I've got a data structure like this:</p>
  
  <p><a href="https://i.stack.imgur.com/kXC5P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kXC5P.png" alt="enter image description here"></a></p>
  
  <p>How can I access <code>/Restaurant/-KK37k6g5cYYippEHpZ3/User/-KK37k6g5cYYippEHpZ4/id</code>'s value within the firebase security rules? The two push keys should be wildcards. I need something like this:</p>
  
  <pre><code>"Restaurant": {
          "$id": {
              ".read": "auth.uid != null",
              ".write": "data.child($id).child('User').child($anotherWildcard).child('id').val() === auth.uid"  
          }
      }
  </code></pre>