title: Firebase Rules Wildcard and Child comparison
body: <p>I'm trying to mix Firebase's Rule wildcards with children comparisons.</p>
  
  <p>I'm reading a child elsewhere who's value is '4'.</p>
  
  <p>When I do a literal comparison, the simulator gives me the green light (like this):</p>
  
  <pre><code>{
    "rules": {
      "die": {
        "rolls": {
          "$i": {
            ".read": "4 == root.child('die/i').val()"
          }
        },
        "i": {
          ".read": true,
          ".write": true
        }
      }
    }
  }
  </code></pre>
  
  <p>Output (success):</p>
  
  <pre><code>Type    read
  Location    /die/rolls/4
  Data    null
  Auth    null
  Read successful
  Line 7 (/die/rolls/4)
  read: "4 == root.child('die/i').val()"
  </code></pre>
  
  <p>But a wildcard comparison fails. Why?</p>
  
  <pre><code>{
    "rules": {
      "die": {
        "rolls": {
          "$i": {
            ".read": "$i == root.child('die/i').val()"
          }
        },
        "i": {
          ".read": true,
          ".write": true
        }
      }
    }
  }
  </code></pre>
  
  <p>Output (failure):</p>
  
  <pre><code>Type    read
  Location    /die/rolls/4
  Data    null
  Auth    null
  Read denied
  Line 7 (/die/rolls/4)
  read: "$i == root.child('die/i').val()"
  </code></pre>
  
  <p>(also, I've tried simulating authentication; same thing.)</p>