Firebase deep querying
<p>This question is about implementing firebase deep querying. Consider the following structure in firebase:</p>

<p><a href="https://i.stack.imgur.com/hnO44.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hnO44.png" alt="enter image description here"></a></p>

<p>Here, my ref is pointing to the root of the structure which is <code>/messages</code>. So I have :</p>

<pre><code>var ref = new Firebase("https://cofounder.firebaseio.com/messages");
</code></pre>

<p>I wish to query those message Id's having <code>member = -752163252</code> . So basically the returned object should be the one with key <code>655974744</code> . How do I go about doing this in firebase?</p>

<p>Here's what I tried in my console:</p>

<pre><code>ref.orderByChild("members").equalTo(235642888).on('value', function(snap){console.log("Found ",snap.val())});
</code></pre>

<p>Result was:</p>

<pre><code>VM837:2 Found  null
</code></pre>

<p>I sense there is a missing link somewhere. Basically, I want to know if there is any way to query the deep nested data without having the parent key id's (in this case 25487894,655974744) . </p>

<p>Also, if I may extend my question, is there a way to add a listener that calls back when a new messageId (in this case 25487894,655974744) is added containing <code>member = -752163252</code> .</p>

<p>Hope my question is clear enough. Any help is greatly appreciated!</p>

<p>EDIT:</p>

<p>I have already looked at the dinosaurs example, and that's how I tried what I tried but it didn't work.</p>