title: Firebase security rules - difference in behaviour between Simulator and code
body: <p>Data</p>
  
  <pre><code>"directChat" : {
    "creator" : {
      "1-L6HQZZSvJ0aarUmXdtN" : {
        "ID" : "XXX",
        "fbID" : "YYY",
        "name" : "Hari"
      }
    },
    "target" : {
      "1-L6HQZZSvJ0aarUmXdtN" : {
        "ID" : "ZZZ",
        "fbID" : "AAA",
        "name" : "John Doe"
      }
    }
  }
  </code></pre>
  
  <p>Security Rule</p>
  
  <pre><code>"directChat": {
    "creator": {
      "$cID": {
        ".write": "data.val() == null &amp;&amp; auth != null &amp;&amp; newData.parent().parent().parent().child('directChat/creator/' + $cID + '/ID').val() == auth.uid",
        ".read": "auth != null &amp;&amp; data.child('revealed').val() == true &amp;&amp; root.child('directChat/target/' + $cID + '/ID').val() == auth.uid"
      },
      ".read": "auth != null &amp;&amp; auth.uid == query.equalTo &amp;&amp; query.orderByChild == 'ID'"
    }
  }
  </code></pre>
  
  <p>Firebase Simulator</p>
  
  <pre><code>Simulation type - Read
  Ref - /directChat/creator/1-L6HQZZSvJ0aarUmXdtN/
  UID - XXX
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>async runTests(){
    var creatorIsMe = await firebase.database().ref('directChat/creator/1-L6HQZZSvJ0aarUmXdtN/').once('value')
    console.warn('value1', creatorIsMe)
  }
  </code></pre>
  
  <p>Simulation fails, which is the expected behaviour but my code returns the snapshot! What am I missing?</p>